Skip to content

Commit 3ba6011

Browse files
skipna not yet available on 2.3 for groupby
1 parent 4940c51 commit 3ba6011

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

pandas/tests/groupby/test_reductions.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ def test_min_empty_string_dtype(func, string_dtype_no_object):
714714
@pytest.mark.parametrize("min_count", [0, 1])
715715
@pytest.mark.parametrize("test_series", [True, False])
716716
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
718718
):
719719
# https://github.com/pandas-dev/pandas/issues/60985
720720
if reduction_func == "corrwith":
@@ -733,19 +733,19 @@ def test_string_dtype_all_na(
733733
"std",
734734
"var",
735735
]:
736-
kwargs = {"skipna": skipna}
736+
kwargs = {}
737737
elif reduction_func in ["kurt"]:
738738
kwargs = {"min_count": min_count}
739739
elif reduction_func in ["count", "nunique", "quantile", "sem", "size"]:
740740
kwargs = {}
741741
else:
742-
kwargs = {"skipna": skipna, "min_count": min_count}
742+
kwargs = {"min_count": min_count}
743743

744744
expected_dtype, expected_value = dtype, pd.NA
745745
if reduction_func in ["all", "any"]:
746746
expected_dtype = "bool"
747747
# 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
749749
elif reduction_func in ["count", "nunique", "size"]:
750750
# TODO: Should be more consistent - return Int64 when dtype.na_value is pd.NA?
751751
if (
@@ -760,7 +760,7 @@ def test_string_dtype_all_na(
760760
expected_value = 1 if reduction_func == "size" else 0
761761
elif reduction_func in ["idxmin", "idxmax"]:
762762
expected_dtype, expected_value = "float64", np.nan
763-
elif not skipna or min_count > 0:
763+
elif min_count > 0:
764764
expected_value = pd.NA
765765
elif reduction_func == "sum":
766766
# https://github.com/pandas-dev/pandas/pull/60936
@@ -787,11 +787,6 @@ def test_string_dtype_all_na(
787787
with pytest.raises(TypeError, match=msg):
788788
method(*args, **kwargs)
789789
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
795790

796791
result = method(*args, **kwargs)
797792
index = pd.Index(["x"], name="a", dtype=dtype)

0 commit comments

Comments
 (0)