Skip to content

CLN: don't catch AttributeError in _wrap_applied_output #29195

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

Merged
merged 2 commits into from
Oct 25, 2019

Conversation

jbrockmendel
Copy link
Member

@@ -198,6 +198,9 @@ def apply(self, f, data, axis=0):
f_name not in base.plotting_methods
and hasattr(splitter, "fast_apply")
and axis == 0
# with MultiIndex, apply_frame_axis0 would raise InvalidApply
# TODO: can we make this check prettier?
and not splitter._get_sorted_data().index._has_complex_internals
Copy link
Member

Choose a reason for hiding this comment

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

Do you generally know of a reason why we have _has_complex_internals as a Index property? I think only changed for a MultiIndex and only applicable in groupby space.

Might be easier and clearer to just do a isinstance(..., MultiIndex)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not aware of the history there no.

Copy link
Member

Choose a reason for hiding this comment

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

Cool; just asking - probably a historical relic.

Haven't gone too deep on this one yet but will file comments (most likely) tomorrow

Copy link
Contributor

Choose a reason for hiding this comment

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

_has_complex_internals predates me :->

@gfyoung gfyoung added Clean Error Reporting Incorrect or improved errors from pandas labels Oct 24, 2019
stacked_values = np.vstack([np.asarray(v) for v in values])
result = DataFrame(
stacked_values.T, index=v.index, columns=key_index
)
else:
# GH#1738: values is list of arrays of unequal lengths
Copy link
Contributor

Choose a reason for hiding this comment

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

a better way to do this would be to make this if/elif into a function, then just return on the if/elif; that way you can avoid suplicating 1279 and 1287

Copy link
Member Author

Choose a reason for hiding this comment

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

generally agree, but I think the version on 1287 doesnt need to be there at all (not reached in tests). Just not removing it until im sure

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, then merge this and followup?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes please. got a couple of local branches about ready to go

@jreback jreback added this to the 1.0 milestone Oct 25, 2019
@WillAyd WillAyd merged commit 4ccea11 into pandas-dev:master Oct 25, 2019
@WillAyd
Copy link
Member

WillAyd commented Oct 25, 2019

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the faster45 branch October 25, 2019 17:36
HawkinsBA pushed a commit to HawkinsBA/pandas that referenced this pull request Oct 29, 2019
Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
bongolegend pushed a commit to bongolegend/pandas that referenced this pull request Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants