Skip to content

Commit

Permalink
Add test for empty partitions after groupby
Browse files Browse the repository at this point in the history
  • Loading branch information
Retribution98 committed Aug 22, 2024
1 parent 2d73dda commit 81d8039
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion modin/tests/pandas/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@
import pytest

import modin.pandas as pd
from modin.config import IsRayCluster, NPartitions, RangePartitioning, StorageFormat
from modin.config import (
DynamicPartitioning,
IsRayCluster,
NPartitions,
RangePartitioning,
StorageFormat,
)
from modin.core.dataframe.algebra.default2pandas.groupby import GroupBy
from modin.core.dataframe.pandas.partitioning.axis_partition import (
PandasDataframeAxisPartition,
Expand Down Expand Up @@ -2431,6 +2437,32 @@ def test_multi_column_groupby_different_partitions(
)


def test_empty_partitions_after_groupby():
DynamicPartitioning.put(True)

def func_to_apply(grp):
return grp.agg(
{
list(test_data_values[0].keys())[1]: "sum",
list(test_data_values[0].keys())[-1]: "sum",
}
)

data = test_data_values[0]
md_df, pd_df = create_test_dfs(data)
by = pd_df.columns[0]

md_grp, pd_grp = (
md_df.groupby(by),
pd_df.groupby(by),
)
eval_general(
md_grp,
pd_grp,
func_to_apply,
)


@pytest.mark.parametrize(
"by",
[
Expand Down

0 comments on commit 81d8039

Please sign in to comment.