We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent afc1372 commit 5117fd1Copy full SHA for 5117fd1
bisect/46375.py
@@ -0,0 +1,12 @@
1
+# BUG: DataFrameGroupBy.sum() drops column names when applied to an empty dataframe #46375
2
+
3
+import pandas as pd
4
5
+print(pd.__version__)
6
7
+df = pd.DataFrame(columns=["a", "b", "c"])
8
+result = df.groupby("a", as_index=False).sum()
9
+print(result)
10
11
+expected = pd.Index(["a", "b", "c"], dtype="object")
12
+pd.testing.assert_index_equal(result.columns, expected)
0 commit comments