File tree 1 file changed +9
-2
lines changed
pandas/tests/groupby/transform
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 6
6
from pandas ._config import using_string_dtype
7
7
8
8
from pandas ._libs import lib
9
+ from pandas .compat import HAS_PYARROW
9
10
10
11
from pandas .core .dtypes .common import ensure_platform_int
11
12
@@ -384,7 +385,10 @@ def test_transform_nuisance_raises(df, using_infer_string):
384
385
gbc = grouped ["B" ]
385
386
msg = "Could not convert"
386
387
if using_infer_string :
387
- msg = "with dtype str does not support operation 'mean'"
388
+ if df .columns .dtype .storage == "pyarrow" :
389
+ msg = "with dtype str does not support operation 'mean'"
390
+ else :
391
+ msg = "Cannot perform reduction 'mean' with string dtype"
388
392
with pytest .raises (TypeError , match = msg ):
389
393
gbc .transform (lambda x : np .mean (x ))
390
394
@@ -479,7 +483,10 @@ def test_groupby_transform_with_int(using_infer_string):
479
483
)
480
484
msg = "Could not convert"
481
485
if using_infer_string :
482
- msg = "with dtype str does not support operation 'mean'"
486
+ if HAS_PYARROW :
487
+ msg = "with dtype str does not support operation 'mean'"
488
+ else :
489
+ msg = "Cannot perform reduction 'mean' with string dtype"
483
490
with np .errstate (all = "ignore" ):
484
491
with pytest .raises (TypeError , match = msg ):
485
492
df .groupby ("A" ).transform (lambda x : (x - x .mean ()) / x .std ())
You can’t perform that action at this time.
0 commit comments