40
40
pa_version_under11p0 ,
41
41
pa_version_under13p0 ,
42
42
pa_version_under14p0 ,
43
+ pa_version_under20p0 ,
43
44
)
44
45
45
46
from pandas .core .dtypes .dtypes import (
@@ -448,6 +449,9 @@ def test_accumulate_series(self, data, all_numeric_accumulations, skipna, reques
448
449
self .check_accumulate (ser , op_name , skipna )
449
450
450
451
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
+
451
455
dtype = ser .dtype
452
456
# error: Item "dtype[Any]" of "dtype[Any] | ExtensionDtype" has
453
457
# no attribute "pyarrow_dtype"
@@ -464,7 +468,7 @@ def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:
464
468
pass
465
469
else :
466
470
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" ] :
468
472
return False
469
473
elif (
470
474
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
537
541
"median" ,
538
542
}:
539
543
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
+ )
540
558
super ().test_reduce_series_numeric (data , all_numeric_reductions , skipna )
541
559
542
560
@pytest .mark .parametrize ("skipna" , [True , False ])
@@ -563,7 +581,7 @@ def _get_expected_reduction_dtype(self, arr, op_name: str, skipna: bool):
563
581
if op_name in ["max" , "min" ]:
564
582
cmp_dtype = arr .dtype
565
583
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" ]:
567
585
cmp_dtype = arr .dtype
568
586
else :
569
587
cmp_dtype = "float64[pyarrow]"
@@ -582,7 +600,7 @@ def _get_expected_reduction_dtype(self, arr, op_name: str, skipna: bool):
582
600
@pytest .mark .parametrize ("skipna" , [True , False ])
583
601
def test_reduce_frame (self , data , all_numeric_reductions , skipna , request ):
584
602
op_name = all_numeric_reductions
585
- if op_name == "skew" :
603
+ if op_name == "skew" and pa_version_under20p0 :
586
604
if data .dtype ._is_numeric :
587
605
mark = pytest .mark .xfail (reason = "skew not implemented" )
588
606
request .applymarker (mark )
0 commit comments