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

ENH: add GroupBy.pipe method #17871

Merged
merged 1 commit into from Oct 18, 2017

Conversation

Projects
None yet
5 participants
@topper-123
Contributor

topper-123 commented Oct 14, 2017

  • [x ] closes #10353, see also #17863
  • [x ] tests added / passed
  • [ x] passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • [ x] whatsnew entry

This PR adds a .pipe method to GroupBy objects like for DataFrame.pipe and Series .pipe.

This PR is basically #10466 written by @ghl3 with some very minor updates, because that PR somehow got stalled and subsequently was closed.

This PR says it's new in 0.21, but I'll change that if it's too late to add this.

@topper-123 topper-123 changed the title from add GroupBy.pipe method to ENH: add GroupBy.pipe method Oct 14, 2017

Show outdated Hide outdated doc/source/groupby.rst
Show outdated Hide outdated doc/source/groupby.rst
Show outdated Hide outdated doc/source/groupby.rst
Show outdated Hide outdated pandas/core/common.py
kwargs[target] = obj
return func(*args, **kwargs)
else:
return func(obj, *args, **kwargs)

This comment has been minimized.

@jreback

jreback Oct 14, 2017

Contributor

need a return at the end

@jreback

jreback Oct 14, 2017

Contributor

need a return at the end

This comment has been minimized.

@topper-123

topper-123 Oct 17, 2017

Contributor

Done.

@topper-123

topper-123 Oct 17, 2017

Contributor

Done.

@ghl3

This comment has been minimized.

Show comment
Hide comment
@ghl3

ghl3 Oct 14, 2017

@topper-123 Thanks a lot for reviving this feature.

ghl3 commented Oct 14, 2017

@topper-123 Thanks a lot for reviving this feature.

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Oct 14, 2017

Codecov Report

Merging #17871 into master will increase coverage by <.01%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17871      +/-   ##
==========================================
+ Coverage   91.23%   91.24%   +<.01%     
==========================================
  Files         163      163              
  Lines       50105    50110       +5     
==========================================
+ Hits        45715    45723       +8     
+ Misses       4390     4387       -3
Flag Coverage Δ
#multiple 89.05% <50%> (+0.02%) ⬆️
#single 40.31% <16.66%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/generic.py 92.53% <100%> (+0.33%) ⬆️
pandas/core/groupby.py 91.99% <100%> (ø) ⬆️
pandas/core/common.py 91.18% <33.33%> (-1.63%) ⬇️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️
pandas/core/indexes/datetimes.py 95.41% <0%> (-0.1%) ⬇️
pandas/core/dtypes/dtypes.py 95.14% <0%> (ø) ⬆️
pandas/plotting/_converter.py 65.2% <0%> (+1.81%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bf7f9a...608a0e4. Read the comment docs.

codecov bot commented Oct 14, 2017

Codecov Report

Merging #17871 into master will increase coverage by <.01%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17871      +/-   ##
==========================================
+ Coverage   91.23%   91.24%   +<.01%     
==========================================
  Files         163      163              
  Lines       50105    50110       +5     
==========================================
+ Hits        45715    45723       +8     
+ Misses       4390     4387       -3
Flag Coverage Δ
#multiple 89.05% <50%> (+0.02%) ⬆️
#single 40.31% <16.66%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/generic.py 92.53% <100%> (+0.33%) ⬆️
pandas/core/groupby.py 91.99% <100%> (ø) ⬆️
pandas/core/common.py 91.18% <33.33%> (-1.63%) ⬇️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️
pandas/core/indexes/datetimes.py 95.41% <0%> (-0.1%) ⬇️
pandas/core/dtypes/dtypes.py 95.14% <0%> (ø) ⬆️
pandas/plotting/_converter.py 65.2% <0%> (+1.81%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bf7f9a...608a0e4. Read the comment docs.

@topper-123

This comment has been minimized.

Show comment
Hide comment
@topper-123

topper-123 Oct 14, 2017

Contributor

@jreback , I've made changes to the PR. Travis was green and newest forcepush is just for some linting issues.

@ghl3, well, thank you for writing most of this:-)

Contributor

topper-123 commented Oct 14, 2017

@jreback , I've made changes to the PR. Travis was green and newest forcepush is just for some linting issues.

@ghl3, well, thank you for writing most of this:-)

@jreback jreback added this to the 0.21.0 milestone Oct 14, 2017

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback
Contributor

jreback commented Oct 14, 2017

@topper-123

This comment has been minimized.

Show comment
Hide comment
@topper-123

topper-123 Oct 15, 2017

Contributor

Had some git issue, so squashed all the commits.

I'm off to sleep, I'll look into eventual comments tomorrow.

Contributor

topper-123 commented Oct 15, 2017

Had some git issue, so squashed all the commits.

I'm off to sleep, I'll look into eventual comments tomorrow.

@jorisvandenbossche

Added some minor comments

Show outdated Hide outdated pandas/core/generic.py
Show outdated Hide outdated pandas/core/groupby.py
@topper-123

This comment has been minimized.

Show comment
Hide comment
@topper-123

topper-123 Oct 17, 2017

Contributor

The comments from @jorisvandenbossche have been addressed. Thanks for reviewing.

Contributor

topper-123 commented Oct 17, 2017

The comments from @jorisvandenbossche have been addressed. Thanks for reviewing.

Show outdated Hide outdated doc/source/whatsnew/v0.21.0.txt
Show outdated Hide outdated pandas/core/groupby.py
expected = pd.Series([-79.5160891089, -78.4839108911, None],
index=index)
assert_series_equal(expected, result)

This comment has been minimized.

@jreback

jreback Oct 17, 2017

Contributor

can you add a tests on SeriesGroupBy

@jreback

jreback Oct 17, 2017

Contributor

can you add a tests on SeriesGroupBy

This comment has been minimized.

@topper-123

topper-123 Oct 17, 2017

Contributor

Ok

@topper-123

topper-123 Oct 17, 2017

Contributor

Ok

@topper-123

This comment has been minimized.

Show comment
Hide comment
@topper-123

topper-123 Oct 17, 2017

Contributor

Hmm, I can see the newest code changes on my github repository, but they don't show up in the PR. Any suggestions on how to proceed?

for reference, the newest code her: topper-123@8614c32

EDIT: never mind, it works now.

Contributor

topper-123 commented Oct 17, 2017

Hmm, I can see the newest code changes on my github repository, but they don't show up in the PR. Any suggestions on how to proceed?

for reference, the newest code her: topper-123@8614c32

EDIT: never mind, it works now.

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Oct 17, 2017

Contributor

I think you need to add in api.rst as well. if docs build ok, ping on green.

Contributor

jreback commented Oct 17, 2017

I think you need to add in api.rst as well. if docs build ok, ping on green.

tp

@jreback jreback merged commit 5687f9e into pandas-dev:master Oct 18, 2017

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Oct 18, 2017

Contributor

thanks @ghl3 and @topper-123 for the revival

Contributor

jreback commented Oct 18, 2017

thanks @ghl3 and @topper-123 for the revival

@ghl3

This comment has been minimized.

Show comment
Hide comment
@ghl3

ghl3 commented Oct 18, 2017

Great work, @jreback and @topper-123

yeemey added a commit to yeemey/pandas that referenced this pull request Oct 20, 2017

wooyekim added a commit to wooyekim/pandas that referenced this pull request Oct 29, 2017

Dobatymo added a commit to Dobatymo/pandas that referenced this pull request Oct 30, 2017

@topper-123 topper-123 deleted the topper-123:groupby.pipe branch Nov 6, 2017

alanbato added a commit to alanbato/pandas that referenced this pull request Nov 10, 2017

No-Stream added a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017

@topper-123 topper-123 referenced this pull request Dec 26, 2017

Merged

ENH: Let Resampler objects have a pipe method #18940

4 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment