@@ -467,17 +467,14 @@ def test_accumulate_series(self, data, all_numeric_accumulations, skipna, reques
467
467
self .check_accumulate (ser , op_name , skipna )
468
468
469
469
def _supports_reduction (self , ser : pd .Series , op_name : str ) -> bool :
470
+ if op_name in ["kurt" , "skew" ]:
471
+ return False
472
+
470
473
dtype = ser .dtype
471
474
# error: Item "dtype[Any]" of "dtype[Any] | ExtensionDtype" has
472
475
# no attribute "pyarrow_dtype"
473
476
pa_dtype = dtype .pyarrow_dtype # type: ignore[union-attr]
474
- if pa .types .is_temporal (pa_dtype ) and op_name in [
475
- "sum" ,
476
- "var" ,
477
- "skew" ,
478
- "kurt" ,
479
- "prod" ,
480
- ]:
477
+ if pa .types .is_temporal (pa_dtype ) and op_name in ["sum" , "var" , "prod" ]:
481
478
if pa .types .is_duration (pa_dtype ) and op_name in ["sum" ]:
482
479
# summing timedeltas is one case that *is* well-defined
483
480
pass
@@ -493,8 +490,6 @@ def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:
493
490
"std" ,
494
491
"sem" ,
495
492
"var" ,
496
- "skew" ,
497
- "kurt" ,
498
493
]:
499
494
return False
500
495
@@ -541,23 +536,6 @@ def check_reduce(self, ser: pd.Series, op_name: str, skipna: bool):
541
536
expected = getattr (alt , op_name )(skipna = skipna )
542
537
tm .assert_almost_equal (result , expected )
543
538
544
- @pytest .mark .parametrize ("skipna" , [True , False ])
545
- def test_reduce_series_numeric (self , data , all_numeric_reductions , skipna , request ):
546
- dtype = data .dtype
547
- pa_dtype = dtype .pyarrow_dtype
548
-
549
- xfail_mark = pytest .mark .xfail (
550
- raises = TypeError ,
551
- reason = (
552
- f"{ all_numeric_reductions } is not implemented in "
553
- f"pyarrow={ pa .__version__ } for { pa_dtype } "
554
- ),
555
- )
556
- if all_numeric_reductions in {"skew" , "kurt" } and dtype ._is_numeric :
557
- request .applymarker (xfail_mark )
558
-
559
- super ().test_reduce_series_numeric (data , all_numeric_reductions , skipna )
560
-
561
539
@pytest .mark .parametrize ("skipna" , [True , False ])
562
540
def test_reduce_series_boolean (
563
541
self , data , all_boolean_reductions , skipna , na_value , request
@@ -596,11 +574,11 @@ def _get_expected_reduction_dtype(self, arr, op_name: str, skipna: bool):
596
574
else :
597
575
cmp_dtype = arr .dtype
598
576
elif arr .dtype .name == "decimal128(7, 3)[pyarrow]" :
599
- if op_name not in ["median" , "var" , "std" ]:
577
+ if op_name not in ["median" , "var" , "std" , "sem" ]:
600
578
cmp_dtype = arr .dtype
601
579
else :
602
580
cmp_dtype = "float64[pyarrow]"
603
- elif op_name in ["median" , "var" , "std" , "mean" , "skew" ]:
581
+ elif op_name in ["median" , "var" , "std" , "mean" , "skew" , "sem" ]:
604
582
cmp_dtype = "float64[pyarrow]"
605
583
elif op_name in ["sum" , "prod" ] and pa .types .is_boolean (pa_type ):
606
584
cmp_dtype = "uint64[pyarrow]"
@@ -619,7 +597,11 @@ def test_reduce_frame(self, data, all_numeric_reductions, skipna, request):
619
597
if data .dtype ._is_numeric :
620
598
mark = pytest .mark .xfail (reason = "skew not implemented" )
621
599
request .applymarker (mark )
622
- elif op_name == "std" and pa .types .is_date64 (data ._pa_array .type ) and skipna :
600
+ elif (
601
+ op_name in ["std" , "sem" ]
602
+ and pa .types .is_date64 (data ._pa_array .type )
603
+ and skipna
604
+ ):
623
605
# overflow
624
606
mark = pytest .mark .xfail (reason = "Cannot cast" )
625
607
request .applymarker (mark )
0 commit comments