SNOW-1757439, SNOW-1757441: Support DataFrameGroupBy/SeriesGroupBy.pct_change#2625
Conversation
9cc7cdc to
bef44c8
Compare
8af07b0 to
04b63bd
Compare
04b63bd to
bcc08e1
Compare
| ): | ||
| # TODO: SNOW-1063349: Modin upgrade - modin.pandas.groupby.DataFrameGroupBy functions | ||
| ErrorMessage.method_not_implemented_error(name="pct_change", class_="GroupBy") | ||
| if fill_method not in (no_default, None) or limit is not no_default: |
There was a problem hiding this comment.
why not separate this into two different warnings? It would make the error message easier to read and less verbose.
There was a problem hiding this comment.
I copied this from modin, which copied the message from pandas.
| "params", | ||
| [ | ||
| {"limit": 1}, | ||
| {"freq": 1}, |
There was a problem hiding this comment.
add test for axis=1?
sfc-gh-helmeleegy
left a comment
There was a problem hiding this comment.
PR looks good to me overall. Just please add the needed extra test coverage.
sfc-gh-rdurrani
left a comment
There was a problem hiding this comment.
overall lgtm, left some comments.
There was a problem hiding this comment.
shouldn't we error if the length isn't greater than 0? That would mean that we got to this point in the code and have a label that doesn't have any corresponding columns in the dataframe?
There was a problem hiding this comment.
Good point. This case should be caught gracefully by the groupby frontend if the user specifies a missing label, so I went ahead and just removed this line.
| ] | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("periods", [0, 1, 2, -1]) |
There was a problem hiding this comment.
We should get some tests with NA values to make sure they are propagated (or filled correctly if fill_method is specified).
There was a problem hiding this comment.
Added! (also caught some bugs with it)
sfc-gh-vbudati
left a comment
There was a problem hiding this comment.
Looks great, thanks Jonathan!!
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-1757439, SNOW-1757441
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
This PR implements GroupBy.pct_change on top of the existing pct_change API.
Leaving changelog un-updated until 1.25 is cut/merged back.