8000 BUG: groupby with as_index=False shouldn't modify grouping columns by rhshadrach · Pull Request #34012 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: groupby with as_index=False shouldn't modify grouping columns #34012

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 5 commits into from
May 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed old test
  • Loading branch information
rhshadrach committed May 20, 2020
commit 3a0e80bd24d7c5fdef31e49ebc20cc3b761c7d7c
22 changes: 0 additions & 22 deletions pandas/tests/groupby/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,28 +573,6 @@ def test_ops_general(op, targop):
tm.assert_frame_equal(result, expected)


def test_ops_not_as_index(reduction_func):
# GH 10355
# Using as_index=False should not modify grouped column

if reduction_func in ("nth", "ngroup", "size",):
pytest.skip("Skip until behavior is determined (GH #5755)")

if reduction_func in ("corrwith", "idxmax", "idxmin", "mad", "nunique", "skew",):
pytest.xfail(
"_GroupBy._python_apply_general incorrectly modifies grouping columns"
)

df = DataFrame(np.random.randint(0, 5, size=(100, 2)), columns=["a", "b"])
expected = getattr(df.groupby("a"), reduction_func)().reset_index()

result = getattr(df.groupby("a", as_index=False), reduction_func)()
tm.assert_frame_equal(result, expected)

result = getattr(df.groupby("a", as_index=False)["b"], reduction_func)()
tm.assert_frame_equal(result, expected)


def test_max_nan_bug():
raw = """,Date,app,File
-04-23,2013-04-23 00:00:00,,log080001.log
Expand Down
0