Skip to content

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

Merged
merged 4 commits into from
Feb 15, 2021
Merged

Conversation

ftrihardjo
Copy link
Contributor

@ftrihardjo ftrihardjo commented Feb 7, 2021

@MarcoGorelli
Copy link
Member

Thanks @ftrihardjo - could you make the title the same as the issue please, and put the issue number in the pull request body (near closes #) ?

@jreback jreback changed the title pandas-dev issue #24211 API: transform behaves differently with 'ffill' on DataFrameGroupBy and SeriesGroupBy Feb 7, 2021
@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Testing pandas testing functions or related to the test suite labels Feb 7, 2021
@jreback jreback added this to the 1.3 milestone Feb 7, 2021
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"],
Copy link
Contributor

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"),
)

Copy link
Contributor

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")]]
Copy link
Contributor

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)

@ftrihardjo ftrihardjo requested a review from jreback February 13, 2021 00:09
@jreback jreback merged commit 9c5ea61 into pandas-dev:master Feb 15, 2021
@jreback
Copy link
Contributor

jreback commented Feb 15, 2021

thanks @ftrihardjo

znicholls pushed a commit to znicholls/pandas that referenced this pull request Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

transform behaves differently with 'ffill' on DataFrameGroupBy and SeriesGroupBy
3 participants