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

Fix dataframe warning #85

Merged
merged 3 commits into from
Mar 5, 2024
Merged

Conversation

harisang
Copy link
Contributor

@harisang harisang commented Mar 5, 2024

This PR addresses issue #82

@harisang harisang requested a review from fhenneke March 5, 2024 00:49
Copy link
Contributor

@fhenneke fhenneke left a comment

Choose a reason for hiding this comment

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

Looks like it does what it is supposed to.

One thing I do not understand is if this fix is equivalent to the old behavior of concat or the new behavior? Or does it make no difference in our case?

Comment on lines +91 to +97
if not prod.empty and not barn.empty:
return pd.concat([prod, barn])
if not prod.empty:
return prod.copy()
if not barn.empty:
return barn.copy()
return pd.DataFrame()
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it does what it is supposed to. The following looks more pythonic, but I have not tested it.

Suggested change
if not prod.empty and not barn.empty:
return pd.concat([prod, barn])
if not prod.empty:
return prod.copy()
if not barn.empty:
return barn.copy()
return pd.DataFrame()
return pd.concat(df for df in [prod, barn] if not df.empty)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah agreed but i don't feel that comfortable with all these compact pythonic ways, so if you don't mind, i want to test it as is and then we can potentially make it nicer in the future.

@harisang harisang merged commit abfc588 into main Mar 5, 2024
6 checks passed
@harisang harisang deleted the fix_dataframe_concatentation_warning branch March 5, 2024 09:38
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