Skip to content

Commit

Permalink
code sample for pandas-dev#43205
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins committed Aug 25, 2021
1 parent ee93b9f commit 054676c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bisect/43205.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Combination of groupby with dropna set to True and apply function not returning expected output #43205

import numpy as np
import pandas as pd

print(pd.__version__)

df = pd.DataFrame(
{"a": [1, 2, 3, 4, 5, 6, 7, 8, 9], "b": [1, np.nan, 1, np.nan, 2, 1, 2, np.nan, 1]}
)

df_again = df.groupby("b", dropna=False).apply(lambda x: x)
print(df_again)

pd.testing.assert_frame_equal(df, df_again)

0 comments on commit 054676c

Please sign in to comment.