@@ -714,7 +714,7 @@ def test_min_empty_string_dtype(func, string_dtype_no_object):
714
714
@pytest .mark .parametrize ("min_count" , [0 , 1 ])
715
715
@pytest .mark .parametrize ("test_series" , [True , False ])
716
716
def test_string_dtype_all_na (
717
- string_dtype_no_object , reduction_func , skipna , min_count , test_series
717
+ string_dtype_no_object , reduction_func , min_count , test_series
718
718
):
719
719
# https://github.com/pandas-dev/pandas/issues/60985
720
720
if reduction_func == "corrwith" :
@@ -733,19 +733,19 @@ def test_string_dtype_all_na(
733
733
"std" ,
734
734
"var" ,
735
735
]:
736
- kwargs = {"skipna" : skipna }
736
+ kwargs = {}
737
737
elif reduction_func in ["kurt" ]:
738
738
kwargs = {"min_count" : min_count }
739
739
elif reduction_func in ["count" , "nunique" , "quantile" , "sem" , "size" ]:
740
740
kwargs = {}
741
741
else :
742
- kwargs = {"skipna" : skipna , " min_count" : min_count }
742
+ kwargs = {"min_count" : min_count }
743
743
744
744
expected_dtype , expected_value = dtype , pd .NA
745
745
if reduction_func in ["all" , "any" ]:
746
746
expected_dtype = "bool"
747
747
# TODO: For skipna=False, bool(pd.NA) raises; should groupby?
748
- expected_value = not skipna if reduction_func == "any" else True
748
+ expected_value = False if reduction_func == "any" else True
749
749
elif reduction_func in ["count" , "nunique" , "size" ]:
750
750
# TODO: Should be more consistent - return Int64 when dtype.na_value is pd.NA?
751
751
if (
@@ -760,7 +760,7 @@ def test_string_dtype_all_na(
760
760
expected_value = 1 if reduction_func == "size" else 0
761
761
elif reduction_func in ["idxmin" , "idxmax" ]:
762
762
expected_dtype , expected_value = "float64" , np .nan
763
- elif not skipna or min_count > 0 :
763
+ elif min_count > 0 :
764
764
expected_value = pd .NA
765
765
elif reduction_func == "sum" :
766
766
# https://github.com/pandas-dev/pandas/pull/60936
@@ -787,11 +787,6 @@ def test_string_dtype_all_na(
787
787
with pytest .raises (TypeError , match = msg ):
788
788
method (* args , ** kwargs )
789
789
return
790
- elif reduction_func in ["idxmin" , "idxmax" ] and not skipna :
791
- msg = f"{ reduction_func } with skipna=False encountered an NA value."
792
- with pytest .raises (ValueError , match = msg ):
793
- method (* args , ** kwargs )
794
- return
795
790
796
791
result = method (* args , ** kwargs )
797
792
index = pd .Index (["x" ], name = "a" , dtype = dtype )
0 commit comments