3636cp = lazy_import ("cupy" , rename = "cp" )
3737_agg_size_as_series = pd_release_version >= (1 , 3 )
3838_support_kw_agg = pd_release_version >= (1 , 1 )
39+ _drop_level_reduction = pd_release_version >= (2 , 0 )
3940
4041
4142@pytest .fixture
@@ -119,6 +120,9 @@ def compute(data, **kwargs):
119120 np .testing .assert_equal (r .execute ().fetch (), compute (data ))
120121
121122
123+ @pytest .mark .skipif (
124+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
125+ )
122126@pytest .mark .parametrize ("func_name,func_opts" , reduction_functions )
123127def test_series_level_reduction (setup , func_name , func_opts : FunctionOptions ):
124128 def compute (data , ** kwargs ):
@@ -162,6 +166,9 @@ def compute(data, **kwargs):
162166 )
163167
164168
169+ @pytest .mark .skipif (
170+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
171+ )
165172@pytest .mark .parametrize ("func_name,func_opts" , reduction_functions )
166173def test_dataframe_reduction (
167174 setup , check_ref_counts , func_name , func_opts : FunctionOptions
@@ -255,6 +262,9 @@ def compute(data, **kwargs):
255262 )
256263
257264
265+ @pytest .mark .skipif (
266+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
267+ )
258268@pytest .mark .parametrize ("func_name,func_opts" , reduction_functions )
259269def test_dataframe_level_reduction (
260270 setup , check_ref_counts , func_name , func_opts : FunctionOptions
@@ -403,6 +413,9 @@ def compute(data, **kwargs):
403413 assert r .execute ().fetch () is True
404414
405415
416+ @pytest .mark .skipif (
417+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
418+ )
406419@pytest .mark .parametrize ("func_name" , bool_reduction_functions )
407420def test_series_bool_level_reduction (setup , check_ref_counts , func_name ):
408421 def compute (data , ** kwargs ):
@@ -510,6 +523,9 @@ def compute(data, **kwargs):
510523 )
511524
512525
526+ @pytest .mark .skipif (
527+ _drop_level_reduction , reason = "Level reduction not supported for pandas>=2.0"
528+ )
513529@pytest .mark .parametrize ("func_name" , bool_reduction_functions )
514530def test_dataframe_bool_level_reduction (setup , check_ref_counts , func_name ):
515531 def compute (data , ** kwargs ):
@@ -685,18 +701,20 @@ def test_mode(setup, check_ref_counts):
685701 config_kw = {
686702 "extra_config" : {
687703 "check_shape" : False ,
704+ "check_dtypes" : False ,
705+ "check_columns_value" : False ,
688706 "check_index_value" : False ,
689707 }
690708 }
691709 data1 = pd .Series (np .random .randint (0 , 5 , size = (20 ,)))
692710
693711 series = md .Series (data1 )
694- result = series .mode ().execute ().fetch ()
712+ result = series .mode ().execute (** config_kw ).fetch (** config_kw )
695713 expected = data1 .mode ()
696714 pd .testing .assert_series_equal (result , expected )
697715
698716 series = md .Series (data1 , chunk_size = 6 )
699- result = series .mode ().execute ().fetch ()
717+ result = series .mode ().execute (** config_kw ).fetch (** config_kw )
700718 expected = data1 .mode ()
701719 pd .testing .assert_series_equal (result , expected )
702720
@@ -705,7 +723,7 @@ def test_mode(setup, check_ref_counts):
705723 data2 [[2 , 9 , 18 ]] = np .nan
706724
707725 series = md .Series (data2 )
708- result = series .mode ().execute ().fetch ()
726+ result = series .mode ().execute (** config_kw ).fetch (** config_kw )
709727 expected = data2 .mode ()
710728 pd .testing .assert_series_equal (result , expected )
711729
@@ -720,7 +738,7 @@ def test_mode(setup, check_ref_counts):
720738 columns = ["c" + str (i ) for i in range (20 )],
721739 )
722740 df = md .DataFrame (data1 )
723- result = df .mode ().execute ().fetch ()
741+ result = df .mode ().execute (** config_kw ).fetch (** config_kw )
724742 expected = data1 .mode ()
725743 pd .testing .assert_frame_equal (result , expected )
726744
@@ -730,7 +748,7 @@ def test_mode(setup, check_ref_counts):
730748 pd .testing .assert_frame_equal (result , expected )
731749
732750 df = md .DataFrame (data1 )
733- result = df .mode (axis = 1 ).execute ().fetch ()
751+ result = df .mode (axis = 1 ).execute (** config_kw ).fetch (** config_kw )
734752 expected = data1 .mode (axis = 1 )
735753 pd .testing .assert_frame_equal (result , expected )
736754
@@ -744,7 +762,7 @@ def test_mode(setup, check_ref_counts):
744762 data2 .iloc [[2 , 9 , 18 ], [2 , 9 , 18 ]] = np .nan
745763
746764 df = md .DataFrame (data2 )
747- result = df .mode ().execute ().fetch ()
765+ result = df .mode ().execute (** config_kw ).fetch (** config_kw )
748766 expected = data2 .mode ()
749767 pd .testing .assert_frame_equal (result , expected )
750768
@@ -1008,7 +1026,10 @@ def test_dataframe_aggregate(setup, check_ref_counts):
10081026 mean_9 = NamedAgg (9 , "mean" ),
10091027 )
10101028 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+ )
10121033
10131034
10141035def test_series_aggregate (setup , check_ref_counts ):
0 commit comments