4040 pa_version_under11p0 ,
4141 pa_version_under13p0 ,
4242 pa_version_under14p0 ,
43+ pa_version_under20p0 ,
4344)
4445
4546from pandas .core .dtypes .dtypes import (
@@ -448,6 +449,9 @@ def test_accumulate_series(self, data, all_numeric_accumulations, skipna, reques
448449 self .check_accumulate (ser , op_name , skipna )
449450
450451 def _supports_reduction (self , ser : pd .Series , op_name : str ) -> bool :
452+ if op_name == "kurt" or (pa_version_under20p0 and op_name == "skew" ):
453+ return False
454+
451455 dtype = ser .dtype
452456 # error: Item "dtype[Any]" of "dtype[Any] | ExtensionDtype" has
453457 # no attribute "pyarrow_dtype"
@@ -464,7 +468,7 @@ def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:
464468 pass
465469 else :
466470 return False
467- elif pa .types .is_binary (pa_dtype ) and op_name == "sum" :
471+ elif pa .types .is_binary (pa_dtype ) and op_name in [ "sum" , "skew" ] :
468472 return False
469473 elif (
470474 pa .types .is_string (pa_dtype ) or pa .types .is_binary (pa_dtype )
@@ -537,6 +541,20 @@ def test_reduce_series_numeric(self, data, all_numeric_reductions, skipna, reque
537541 "median" ,
538542 }:
539543 request .applymarker (xfail_mark )
544+ elif (
545+ not pa_version_under20p0
546+ and skipna
547+ and all_numeric_reductions == "skew"
548+ and (
549+ pa .types .is_integer (data .dtype .pyarrow_dtype )
550+ or pa .types .is_floating (data .dtype .pyarrow_dtype )
551+ )
552+ ):
553+ request .applymarker (
554+ pytest .mark .xfail (
555+ reason = "https://github.com/apache/arrow/issues/45733" ,
556+ )
557+ )
540558 super ().test_reduce_series_numeric (data , all_numeric_reductions , skipna )
541559
542560 @pytest .mark .parametrize ("skipna" , [True , False ])
@@ -563,7 +581,7 @@ def _get_expected_reduction_dtype(self, arr, op_name: str, skipna: bool):
563581 if op_name in ["max" , "min" ]:
564582 cmp_dtype = arr .dtype
565583 elif arr .dtype .name == "decimal128(7, 3)[pyarrow]" :
566- if op_name not in ["median" , "var" , "std" ]:
584+ if op_name not in ["median" , "var" , "std" , "skew" ]:
567585 cmp_dtype = arr .dtype
568586 else :
569587 cmp_dtype = "float64[pyarrow]"
@@ -582,7 +600,7 @@ def _get_expected_reduction_dtype(self, arr, op_name: str, skipna: bool):
582600 @pytest .mark .parametrize ("skipna" , [True , False ])
583601 def test_reduce_frame (self , data , all_numeric_reductions , skipna , request ):
584602 op_name = all_numeric_reductions
585- if op_name == "skew" :
603+ if op_name == "skew" and pa_version_under20p0 :
586604 if data .dtype ._is_numeric :
587605 mark = pytest .mark .xfail (reason = "skew not implemented" )
588606 request .applymarker (mark )
0 commit comments