Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amending commit to add ability to group invoices by PIs #11

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions process_report/process_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ def export_pi_billables(dataframe: pandas.DataFrame, output_folder):
if not os.path.exists(output_folder):
os.mkdir(output_folder)

invoice_month = dataframe['Invoice Month'][0]
invoice_month = dataframe['Invoice Month'].iat[0]
Copy link
Contributor Author

@QuanMPhm QuanMPhm Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naved001 The intent of this line and line 127 was to quickly obtain the invoice month and the PI's instituition name from the dataframe. I tried to get this information by indexing into the first element of the Invoice Month and Institution column.
Using [] for indexing was a form of label indexing equivalent to .loc[], which would raise an error if row 0 of the invoice dataframe was not present (which would happen if the project in the first row was unbillable/excluded). iat[] uses position indexing, which would be the appropriate method for this case.

pi_list = dataframe['Manager (PI)'].unique()

for pi in pi_list:
pi_projects = dataframe[dataframe['Manager (PI)'] == pi]
pi_instituition = pi_projects['Institution'].unique()[0]
pi_instituition = pi_projects['Institution'].iat[0]
pi_projects.to_csv(output_folder + f"/{pi_instituition}_{pi}_{invoice_month}.csv")


Expand Down
Loading