-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
There was a problem hiding this 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?
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() |
There was a problem hiding this 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. The following looks more pythonic, but I have not tested it.
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) |
There was a problem hiding this comment.
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.
This PR addresses issue #82