Skip to content

Commit 81d8039

Browse files
committed
Add test for empty partitions after groupby
1 parent 2d73dda commit 81d8039

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

modin/tests/pandas/test_groupby.py

+33-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
import pytest
2222

2323
import modin.pandas as pd
24-
from modin.config import IsRayCluster, NPartitions, RangePartitioning, StorageFormat
24+
from modin.config import (
25+
DynamicPartitioning,
26+
IsRayCluster,
27+
NPartitions,
28+
RangePartitioning,
29+
StorageFormat,
30+
)
2531
from modin.core.dataframe.algebra.default2pandas.groupby import GroupBy
2632
from modin.core.dataframe.pandas.partitioning.axis_partition import (
2733
PandasDataframeAxisPartition,
@@ -2431,6 +2437,32 @@ def test_multi_column_groupby_different_partitions(
24312437
)
24322438

24332439

2440+
def test_empty_partitions_after_groupby():
2441+
DynamicPartitioning.put(True)
2442+
2443+
def func_to_apply(grp):
2444+
return grp.agg(
2445+
{
2446+
list(test_data_values[0].keys())[1]: "sum",
2447+
list(test_data_values[0].keys())[-1]: "sum",
2448+
}
2449+
)
2450+
2451+
data = test_data_values[0]
2452+
md_df, pd_df = create_test_dfs(data)
2453+
by = pd_df.columns[0]
2454+
2455+
md_grp, pd_grp = (
2456+
md_df.groupby(by),
2457+
pd_df.groupby(by),
2458+
)
2459+
eval_general(
2460+
md_grp,
2461+
pd_grp,
2462+
func_to_apply,
2463+
)
2464+
2465+
24342466
@pytest.mark.parametrize(
24352467
"by",
24362468
[

0 commit comments

Comments
 (0)