@@ -644,10 +644,17 @@ def test_npg_nanarg_bug(func):
644
644
assert_equal (actual , expected )
645
645
646
646
647
+ @pytest .mark .parametrize (
648
+ "kwargs" ,
649
+ (
650
+ dict (expected_groups = np .array ([1 , 2 , 4 , 5 ]), isbin = True ),
651
+ dict (expected_groups = pd .IntervalIndex .from_breaks ([1 , 2 , 4 , 5 ])),
652
+ ),
653
+ )
647
654
@pytest .mark .parametrize ("method" , ["cohorts" , "map-reduce" ])
648
655
@pytest .mark .parametrize ("chunk_labels" , [False , True ])
649
656
@pytest .mark .parametrize ("chunks" , ((), (1 ,), (2 ,)))
650
- def test_groupby_bins (chunk_labels , chunks , engine , method ) -> None :
657
+ def test_groupby_bins (chunk_labels , kwargs , chunks , engine , method ) -> None :
651
658
array = [1 , 1 , 1 , 1 , 1 , 1 ]
652
659
labels = [0.2 , 1.5 , 1.9 , 2 , 3 , 20 ]
653
660
@@ -663,14 +670,7 @@ def test_groupby_bins(chunk_labels, chunks, engine, method) -> None:
663
670
664
671
with raise_if_dask_computes ():
665
672
actual , groups = groupby_reduce (
666
- array ,
667
- labels ,
668
- func = "count" ,
669
- expected_groups = np .array ([1 , 2 , 4 , 5 ]),
670
- isbin = True ,
671
- fill_value = 0 ,
672
- engine = engine ,
673
- method = method ,
673
+ array , labels , func = "count" , fill_value = 0 , engine = engine , method = method , ** kwargs
674
674
)
675
675
expected = np .array ([3 , 1 , 0 ], dtype = np .intp )
676
676
for left , right in zip (groups , pd .IntervalIndex .from_arrays ([1 , 2 , 4 ], [2 , 4 , 5 ]).to_numpy ()):
0 commit comments