Skip to content

Commit f309f9f

Browse files
authored
Fix flaky test_dataframe_aggregations_multilevel (#9701)
1 parent a7efdf9 commit f309f9f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

dask/dataframe/groupby.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,9 @@ def _mul_cols(df, cols):
532532
# Fix index in a groupby().apply() context
533533
# https://github.com/dask/dask/issues/8137
534534
# https://github.com/pandas-dev/pandas/issues/43568
535-
_df.index = [0] * len(_df)
535+
# Make sure index dtype is int (even if _df is empty)
536+
# https://github.com/dask/dask/pull/9701
537+
_df.index = np.zeros(len(_df), dtype=int)
536538
return _df
537539

538540

@@ -641,8 +643,10 @@ def _drop_duplicates_reindex(df):
641643
# Fix index in a groupby().apply() context
642644
# https://github.com/dask/dask/issues/8137
643645
# https://github.com/pandas-dev/pandas/issues/43568
646+
# Make sure index dtype is int (even if result is empty)
647+
# https://github.com/dask/dask/pull/9701
644648
result = df.drop_duplicates()
645-
result.index = [0] * len(result)
649+
result.index = np.zeros(len(result), dtype=int)
646650
return result
647651

648652

0 commit comments

Comments
 (0)