-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: transform behaves differently with 'ffill' on DataFrameGroupBy and SeriesGroupBy #39638
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
Conversation
ftrihardjo
commented
Feb 7, 2021
•
edited by jreback
Loading
edited by jreback
- closes transform behaves differently with 'ffill' on DataFrameGroupBy and SeriesGroupBy #24211
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
Thanks @ftrihardjo - could you make the title the same as the issue please, and put the issue number in the pull request body (near |
data = [["a", 0.0], ["a", float("nan")], ["b", 1.0], ["b", float("nan")]] | ||
df = DataFrame(data, columns=["key", "values"]) | ||
tm.assert_series_equal( | ||
df.groupby("key").transform("ffill")["values"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use
result=
expected=
df.groupby("key").transform("ffill")["values"], | ||
df.groupby("key")["values"].transform("ffill"), | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test both for seriesgropuby & dataframegroupby
@@ -938,6 +938,16 @@ def test_any_all_np_func(func): | |||
tm.assert_series_equal(res, exp) | |||
|
|||
|
|||
def test_transform_ffill(): | |||
# GH 24211 | |||
data = [["a", 0.0], ["a", float("nan")], ["b", 1.0], ["b", float("nan")]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you co-locate with other ffill/filling tests (in this file)
thanks @ftrihardjo |