Skip to content

Commit 0293a58

Browse files
code sample for pandas-dev#43209
1 parent a450423 commit 0293a58

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bisect/43209.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# BUG: groupby aggregation methods produce empty DataFrame with mixed DataTypes #43209
2+
3+
import pandas as pd
4+
5+
print(pd.__version__)
6+
7+
8+
df = pd.DataFrame([[1, 2, 3, 4, 5, 6]] * 3)
9+
df.columns = pd.MultiIndex.from_product([["a", "b"], ["i", "j", "k"]])
10+
11+
for col in df.columns:
12+
if col[-1] == "j":
13+
df[col] = df[col].astype("Int64")
14+
15+
result = df.groupby(level=1, axis=1).sum()
16+
print(result)
17+
18+
assert len(result)

0 commit comments

Comments
 (0)