8000 BUG: Groupby selection context not being properly reset by christopherzimmerman · Pull Request #28541 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: Groupby selection context not being properly reset #28541

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

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
Fixed two tests
  • Loading branch information
christopherzimmerman committed Oct 21, 2019
commit 5cc3cb17bc88664d09b098d22e83532896d7519b
4 changes: 2 additions & 2 deletions pandas/tests/groupby/aggregate/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,13 @@ def test_agg_timezone_round_trip():
assert ts == grouped.first()["B"].iloc[0]

# GH#27110 applying iloc should return a DataFrame
assert ts == grouped.apply(lambda x: x.iloc[0]).iloc[0, 0]
assert ts == grouped.apply(lambda x: x.iloc[0]).drop("A", 1).iloc[0, 0]

ts = df["B"].iloc[2]
assert ts == grouped.last()["B"].iloc[0]

# GH#27110 applying iloc should return a DataFrame
assert ts == grouped.apply(lambda x: x.iloc[-1]).iloc[0, 0]
assert ts == grouped.apply(lambda x: x.iloc[-1]).drop("A", 1).iloc[0, 0]


def test_sum_uint64_overflow():
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/groupby/test_grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_grouper_creation_bug(self):
result = g.sum()
assert_frame_equal(result, expected)

result = g.apply(lambda x: x.sum())
result = g.apply(lambda x: x.sum()).drop("A", 1)
assert_frame_equal(result, expected)

g = df.groupby(pd.Grouper(key="A", axis=0))
Expand Down
0