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

Fixes groupby.apply() error when no returns #9684 #9685

Closed
wants to merge 1 commit into from

Conversation

nickeubank
Copy link
Contributor

Closes issue: #9684

Returns empty object even if all entries are missing.

@nickeubank
Copy link
Contributor Author

Sorry, don't quite follow. Would you mind elaborating?

@@ -2808,7 +2808,12 @@ def _wrap_applied_output(self, keys, values, not_indexed_same=False):

# make Nones an empty object
if com._count_not_none(*values) != len(values):
v = next(v for v in values if v is not None)
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

v = [ v for v in values if v is not None ]
if not v:
    return DataFrame()

@nickeubank
Copy link
Contributor Author

OK -- I'd then need to extract the first item from the list below that. That still preferable?

@jreback
Copy link
Contributor

jreback commented Mar 19, 2015

@nickeubank hmm, maybe leave it the original (and put in a try except for StopIteration like you did).
then it doesn't materialzie it

@jreback jreback added Groupby Error Reporting Incorrect or improved errors from pandas labels Mar 19, 2015
@jreback jreback added this to the 0.16.1 milestone Mar 19, 2015
@jreback
Copy link
Contributor

jreback commented Mar 20, 2015

whats new is now available for 0.16.1 5ebf521

@jreback
Copy link
Contributor

jreback commented Mar 25, 2015

pls add a test and a mention in v0.16.1 whatsnew.

@@ -55,7 +55,7 @@ Bug Fixes


- Bug in ``transform`` causing length mismatch when null entries were present and a fast aggregator was being used (:issue:`9697`)

- Fixed bug in groupby.apply() that would cause error if no values returned. (:issue:`9685`)
Copy link
Contributor

Choose a reason for hiding this comment

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

use backticks around groupby.apply and reprase as bit: "would raise if the return value of the user passed function was None "

@jreback
Copy link
Contributor

jreback commented Apr 28, 2015

merged via 990972b

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Groupby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants