Skip to content

ENH: Allow Series.apply to accept list-like and dict-like #39141

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 4 commits into from
Jan 14, 2021

Conversation

rhshadrach
Copy link
Member

I only added the Series.apply list/dict-like addition to the whatsnew. For both Series and DataFrame .agg, this PR also enables passing a Series as a dict-like, but other dict-likes already work. It didn't seem notable to add this to the whatsnew.

@jreback jreback added the Apply Apply, Aggregate, Transform, Map label Jan 13, 2021
@jreback jreback added this to the 1.3 milestone Jan 13, 2021
# Note: dict-likes are list-like
if not is_list_like(self.f):
return None
# pandas\core\apply.py:144: error: "aggregate" of "DataFrame" gets
Copy link
Contributor

Choose a reason for hiding this comment

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

**{axis':self.axis, **self.kwds}) would work here

@jreback
Copy link
Contributor

jreback commented Jan 13, 2021

if my comment works ok, otherwise lgtm. merge either way.

@rhshadrach
Copy link
Member Author

Thanks @jreback - your comment did work, but I found that just removing the keyword axis also works.

@jreback jreback merged commit 363ff8e into pandas-dev:master Jan 14, 2021
@jreback
Copy link
Contributor

jreback commented Jan 14, 2021

thanks @rhshadrach

@rhshadrach rhshadrach deleted the maybe_apply_multiple branch January 15, 2021 01:27
luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Allow apply/agg to accept list-like and dict-like
2 participants