NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import pandas as pd

# Assuming you have loaded both Excel files into pandas DataFrames
# Replace 'entity_file_path' and 'participation_file_path' with your actual file paths

entity_file_path = 'path_to_entity_file.xlsx'
participation_file_path = 'path_to_participation_file.xlsx'

# Load the Entity Hierarchy and Participation files
entity_df = pd.read_excel(entity_file_path)
participation_df = pd.read_excel(participation_file_path)

# Merge the Entity Hierarchy information into the Participation file based on Group_Name
merged_df = pd.merge(participation_df, entity_df, on='Group_Name', how='left', suffixes=('_participation', '_entity'))

# Identify missing values in the columns from Entity Hierarchy
missing_values = merged_df[merged_df['Group_Level_entity'].isnull()]

# Iterate over the missing values and fill them using Parent_Name
for index, row in missing_values.iterrows():
parent_name = row['Parent_Name_participation']
parent_level = row['Parent_Level_participation']

# Filter the Entity Hierarchy based on Parent_Name and Parent_Level
matching_entity = entity_df[(entity_df['Group_Name'] == parent_name) & (entity_df['Group_Level'] == parent_level)]

# Sum the values for Recipients and Respondents for the matching Group_Names
sum_recipients = matching_entity['Recipients'].sum()
sum_respondents = matching_entity['Respondents'].sum()

# Calculate the Score
score = sum_respondents / sum_recipients if sum_recipients > 0 else 0

# Update the missing values in the Participation file
participation_df.loc[index, 'Group_Name'] = parent_name
participation_df.loc[index, 'Group_Level'] = parent_level
participation_df.loc[index, 'Recipients'] = sum_recipients
participation_df.loc[index, 'Respondents'] = sum_respondents
participation_df.loc[index, 'Score'] = score

# Save the updated Participation file
participation_df.to_excel('updated_participation_file.xlsx', index=False)
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.