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

Conversation

QuanMPhm
Copy link
Contributor

@QuanMPhm QuanMPhm commented Apr 1, 2024

I believe the bug comes from two lines which tries to index into the dataframe. I used an inappropriate method for indexing and this should fix it.

@@ -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.

@naved001 naved001 merged commit 1ec80b2 into CCI-MOC:main Apr 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants