Skip to content

Commit f030b25

Browse files
committed
Update _supports_reduction with skew
1 parent 80d4cfd commit f030b25

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

pandas/tests/extension/test_arrow.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -461,24 +461,17 @@ def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:
461461
# error: Item "dtype[Any]" of "dtype[Any] | ExtensionDtype" has
462462
# no attribute "pyarrow_dtype"
463463
pa_dtype = dtype.pyarrow_dtype # type: ignore[union-attr]
464-
if pa.types.is_temporal(pa_dtype) and op_name in ["sum", "var", "prod"]:
464+
if pa.types.is_temporal(pa_dtype) and op_name in ["sum", "var", "prod", "skew"]:
465465
if pa.types.is_duration(pa_dtype) and op_name in ["sum"]:
466466
# summing timedeltas is one case that *is* well-defined
467467
pass
468468
else:
469469
return False
470-
elif pa.types.is_binary(pa_dtype) and op_name == "sum":
470+
elif pa.types.is_binary(pa_dtype) and op_name in ["sum", "skew"]:
471471
return False
472472
elif (
473473
pa.types.is_string(pa_dtype) or pa.types.is_binary(pa_dtype)
474-
) and op_name in [
475-
"mean",
476-
"median",
477-
"prod",
478-
"std",
479-
"sem",
480-
"var",
481-
]:
474+
) and op_name in ["mean", "median", "prod", "std", "sem", "var", "skew"]:
482475
return False
483476

484477
if (
@@ -583,7 +576,7 @@ def _get_expected_reduction_dtype(self, arr, op_name: str, skipna: bool):
583576
@pytest.mark.parametrize("skipna", [True, False])
584577
def test_reduce_frame(self, data, all_numeric_reductions, skipna, request):
585578
op_name = all_numeric_reductions
586-
if op_name == "skew":
579+
if op_name == "skew" and pa_version_under20p0:
587580
if data.dtype._is_numeric:
588581
mark = pytest.mark.xfail(reason="skew not implemented")
589582
request.applymarker(mark)

0 commit comments

Comments
 (0)