Skip to content

Commit a304e47

Browse files
code sample for pandas-dev#45231
1 parent 66ac685 commit a304e47

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

bisect/45231.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# BUG: 1.4.0rc1 Error vectorizing grouping aggregation on empty dataframe with object column #45231
2+
3+
import pandas as pd
4+
5+
print(pd.__version__)
6+
7+
df = pd.DataFrame(
8+
{"group": pd.Series(dtype="object"), "str": pd.Series(dtype="object")}
9+
)
10+
11+
result = df.groupby("group").any()
12+
print(result)
13+
14+
expected = pd.DataFrame(
15+
{"str": pd.Series([], dtype=bool)}, index=pd.Index([], dtype="object", name="group")
16+
)
17+
pd.testing.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)