-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: check instead of catching TypeError #29587
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
Conversation
return concat(results, keys=keys, axis=1, sort=False) | ||
except TypeError: |
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.
What's an example that now ran into this TypeError?
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.
What's an example that now ran into this TypeError?
results = [3, 2, 1.5]; keys = ['size', 'count', 'mean']
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.
Sorry, I meant the original dataframe / groupby example or test case that gives those values at this location
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.
Identifying some relevant cases with an assert False
, the place to look is in tests.frame.test_apply, e.g. test_non_callable_aggregates
thanks @jbrockmendel |
@jreback if I review a PR with a comment, can you try to give me a little bit of time to respond to Brock's response? @jbrockmendel thanks for that reference. So in that test case, you have functions that return single numbers.
This now fails. |
@jorisvandenbossche i gave a day here which is reasonable |
@jreback while i agree an explicit "hold" would be helpful, I think Joris gets some extra slack because of the timezone differences. @jorisvandenbossche have i mentioned recently how much I dislike listlike corner cases? But the case you brought is Technically Correct, so I'd be OK if you want to revert (and add that test case) |
Indeed ;) For me, the "1 day" (15 hours since Brocks comment) was just a morning after having slept.
Do you directly think of another way to do this that you would prefer more than the try/except? Otherwise I can indeed do a revert yes. |
The check in this PR was the best idea I had. Do you have any suggestions? |
We could check for actual series/frame objects (since concat only allows that), but personally, I find this a perfect use case for the try except. |
This reverts commit db4095e.
Added a test case here: #29632 |
No description provided.