Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit b6dcfec

Browse files
committed
test: add test_count_empty_multiindex_columns
1 parent d956453 commit b6dcfec

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/system/small/test_multiindex.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,3 +1490,16 @@ def test_multiindex_eq_const(scalars_df_index, scalars_pandas_df_index):
14901490
bigframes.testing.utils.assert_index_equal(
14911491
pandas.Index(pd_result, dtype="boolean"), bf_result.to_pandas()
14921492
)
1493+
1494+
1495+
def test_count_empty_multiindex_columns(session):
1496+
df = pandas.DataFrame(
1497+
[], index=[1, 2], columns=pandas.MultiIndex.from_tuples([], names=["a", "b"])
1498+
)
1499+
bdf = session.read_pandas(df)
1500+
1501+
# count() operation unpivots columns, triggering the empty MultiIndex bug internally
1502+
count_df = bdf.count().to_pandas()
1503+
assert count_df.shape == (0,)
1504+
assert count_df.index.nlevels == 2
1505+
assert list(count_df.index.names) == ["a", "b"]

0 commit comments

Comments
 (0)