-
Notifications
You must be signed in to change notification settings - Fork 322
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
Pandas FutureWarning: Length 1 tuple will be returned #1374
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.
Instead of repeating the same logic 4 times, I think it would be better to just create a function in sdv/utils.py
. Then you can call that function on the code, it should make things more readable that way.
Also, did you check that the warning doesn't show up anymore? I don't think you need to write any tests, just run locally to make sure the warning doesn't happen anymore.
sdv/single_table/base.py
Outdated
|
||
transformed_groups = transformed_conditions.groupby(transformed_column) | ||
transformed_groups = transformed_conditions.groupby( | ||
groupby_list(transformed_columns) |
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.
The formatting here seems broken, maybe you meant to do like below?
transformed_groups = transformed_conditions.groupby(
groupby_list(transformed_columns))
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.
Yes thank you. I changed this in 1a29185.
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #1374 +/- ##
=======================================
Coverage 96.09% 96.09%
=======================================
Files 48 48
Lines 3712 3714 +2
=======================================
+ Hits 3567 3569 +2
Misses 145 145
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
sdv/utils.py
Outdated
|
||
|
||
def groupby_list(list_to_check): | ||
"""Return the list element if the length is 1 and the list otherwise.""" |
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.
I would use something more descriptive as -> Return the first element of the list if the length is 1 else the entire list.
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.
Yes good idea, done in 41690bd.
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.
I know this test is a little bit challenging, but could we have a unit test or something to ensure that the warning is not being raised anymore?
This reverts commit f73fd8d.
Resolve #1356