36
36
cp = lazy_import ("cupy" , rename = "cp" )
37
37
_agg_size_as_series = pd_release_version >= (1 , 3 )
38
38
_support_kw_agg = pd_release_version >= (1 , 1 )
39
+ _drop_level_reduction = pd_release_version >= (2 , 0 )
39
40
40
41
41
42
@pytest .fixture
@@ -119,6 +120,9 @@ def compute(data, **kwargs):
119
120
np .testing .assert_equal (r .execute ().fetch (), compute (data ))
120
121
121
122
123
+ @pytest .mark .skipif (
124
+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
125
+ )
122
126
@pytest .mark .parametrize ("func_name,func_opts" , reduction_functions )
123
127
def test_series_level_reduction (setup , func_name , func_opts : FunctionOptions ):
124
128
def compute (data , ** kwargs ):
@@ -162,6 +166,9 @@ def compute(data, **kwargs):
162
166
)
163
167
164
168
169
+ @pytest .mark .skipif (
170
+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
171
+ )
165
172
@pytest .mark .parametrize ("func_name,func_opts" , reduction_functions )
166
173
def test_dataframe_reduction (
167
174
setup , check_ref_counts , func_name , func_opts : FunctionOptions
@@ -255,6 +262,9 @@ def compute(data, **kwargs):
255
262
)
256
263
257
264
265
+ @pytest .mark .skipif (
266
+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
267
+ )
258
268
@pytest .mark .parametrize ("func_name,func_opts" , reduction_functions )
259
269
def test_dataframe_level_reduction (
260
270
setup , check_ref_counts , func_name , func_opts : FunctionOptions
@@ -403,6 +413,9 @@ def compute(data, **kwargs):
403
413
assert r .execute ().fetch () is True
404
414
405
415
416
+ @pytest .mark .skipif (
417
+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
418
+ )
406
419
@pytest .mark .parametrize ("func_name" , bool_reduction_functions )
407
420
def test_series_bool_level_reduction (setup , check_ref_counts , func_name ):
408
421
def compute (data , ** kwargs ):
@@ -510,6 +523,9 @@ def compute(data, **kwargs):
510
523
)
511
524
512
525
526
+ @pytest .mark .skipif (
527
+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
528
+ )
513
529
@pytest .mark .parametrize ("func_name" , bool_reduction_functions )
514
530
def test_dataframe_bool_level_reduction (setup , check_ref_counts , func_name ):
515
531
def compute (data , ** kwargs ):
@@ -685,18 +701,20 @@ def test_mode(setup, check_ref_counts):
685
701
config_kw = {
686
702
"extra_config" : {
687
703
"check_shape" : False ,
704
+ "check_dtypes" : False ,
705
+ "check_columns_value" : False ,
688
706
"check_index_value" : False ,
689
707
}
690
708
}
691
709
data1 = pd .Series (np .random .randint (0 , 5 , size = (20 ,)))
692
710
693
711
series = md .Series (data1 )
694
- result = series .mode ().execute ().fetch ()
712
+ result = series .mode ().execute (** config_kw ).fetch (** config_kw )
695
713
expected = data1 .mode ()
696
714
pd .testing .assert_series_equal (result , expected )
697
715
698
716
series = md .Series (data1 , chunk_size = 6 )
699
- result = series .mode ().execute ().fetch ()
717
+ result = series .mode ().execute (** config_kw ).fetch (** config_kw )
700
718
expected = data1 .mode ()
701
719
pd .testing .assert_series_equal (result , expected )
702
720
@@ -705,7 +723,7 @@ def test_mode(setup, check_ref_counts):
705
723
data2 [[2 , 9 , 18 ]] = np .nan
706
724
707
725
series = md .Series (data2 )
708
- result = series .mode ().execute ().fetch ()
726
+ result = series .mode ().execute (** config_kw ).fetch (** config_kw )
709
727
expected = data2 .mode ()
710
728
pd .testing .assert_series_equal (result , expected )
711
729
@@ -720,7 +738,7 @@ def test_mode(setup, check_ref_counts):
720
738
columns = ["c" + str (i ) for i in range (20 )],
721
739
)
722
740
df = md .DataFrame (data1 )
723
- result = df .mode ().execute ().fetch ()
741
+ result = df .mode ().execute (** config_kw ).fetch (** config_kw )
724
742
expected = data1 .mode ()
725
743
pd .testing .assert_frame_equal (result , expected )
726
744
@@ -730,7 +748,7 @@ def test_mode(setup, check_ref_counts):
730
748
pd .testing .assert_frame_equal (result , expected )
731
749
732
750
df = md .DataFrame (data1 )
733
- result = df .mode (axis = 1 ).execute ().fetch ()
751
+ result = df .mode (axis = 1 ).execute (** config_kw ).fetch (** config_kw )
734
752
expected = data1 .mode (axis = 1 )
735
753
pd .testing .assert_frame_equal (result , expected )
736
754
@@ -744,7 +762,7 @@ def test_mode(setup, check_ref_counts):
744
762
data2 .iloc [[2 , 9 , 18 ], [2 , 9 , 18 ]] = np .nan
745
763
746
764
df = md .DataFrame (data2 )
747
- result = df .mode ().execute ().fetch ()
765
+ result = df .mode ().execute (** config_kw ).fetch (** config_kw )
748
766
expected = data2 .mode ()
749
767
pd .testing .assert_frame_equal (result , expected )
750
768
@@ -1008,7 +1026,10 @@ def test_dataframe_aggregate(setup, check_ref_counts):
1008
1026
mean_9 = NamedAgg (9 , "mean" ),
1009
1027
)
1010
1028
result = df .agg (** agg_kw )
1011
- pd .testing .assert_frame_equal (result .execute ().fetch (), data .agg (** agg_kw ))
1029
+ pd .testing .assert_frame_equal (
1030
+ result .execute ().fetch (extra_config = {"check_shape" : False }),
1031
+ data .agg (** agg_kw ),
1032
+ )
1012
1033
1013
1034
1014
1035
def test_series_aggregate (setup , check_ref_counts ):
0 commit comments