Skip to content

Commit 054676c

Browse files
code sample for pandas-dev#43205
1 parent ee93b9f commit 054676c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bisect/43205.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Combination of groupby with dropna set to True and apply function not returning expected output #43205
2+
3+
import numpy as np
4+
import pandas as pd
5+
6+
print(pd.__version__)
7+
8+
df = pd.DataFrame(
9+
{"a": [1, 2, 3, 4, 5, 6, 7, 8, 9], "b": [1, np.nan, 1, np.nan, 2, 1, 2, np.nan, 1]}
10+
)
11+
12+
df_again = df.groupby("b", dropna=False).apply(lambda x: x)
13+
print(df_again)
14+
15+
pd.testing.assert_frame_equal(df, df_again)

0 commit comments

Comments
 (0)