-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: groupby.apply incorrectly dropping nan #43236
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
Changes from 2 commits
a7ed22b
de9fb75
d8fbb75
a27c162
b45f53d
f538d0e
61165ae
9bd155a
1be0556
f6caf30
db077c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1150,3 +1150,17 @@ def test_doctest_example2(): | |
{"B": [1.0, 0.0], "C": [2.0, 0.0]}, index=Index(["a", "b"], name="A") | ||
) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
|
||
@pytest.mark.parametrize("dropna", [True, False]) | ||
def test_apply_dropna_with_indexed_same2(dropna): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test completely supersedes the other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Amended. |
||
# GH#43205 | ||
df = DataFrame( | ||
{ | ||
"a": [1, 2, 3, 4, 5, 6, 7, 8, 9], | ||
"b": [1, np.nan, 1, np.nan, 2, 1, 2, np.nan, 1], | ||
} | ||
) | ||
result = df.groupby("b", dropna=dropna).apply(lambda x: x) | ||
expected = df.dropna() if dropna else df | ||
tm.assert_frame_equal(result, expected) |
Uh oh!
There was an error while loading. Please reload this page.