Skip to content

Commit

Permalink
Backport PR #60635 on branch 2.3.x (TST(string dtype): Resolve xfail …
Browse files Browse the repository at this point in the history
…for corrwith) (#60644)

Backport PR #60635: TST(string dtype): Resolve xfail for corrwith

Co-authored-by: Richard Shadrach <[email protected]>
  • Loading branch information
meeseeksmachine and rhshadrach authored Jan 2, 2025
1 parent 928d221 commit e53967b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pandas/tests/frame/methods/test_cov_corr.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

from pandas._config import using_string_dtype

import pandas.util._test_decorators as td

import pandas as pd
Expand Down Expand Up @@ -328,7 +326,6 @@ def test_corrwith(self, datetime_frame, dtype):
for row in index[:4]:
tm.assert_almost_equal(correls[row], df1.loc[row].corr(df2.loc[row]))

@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
def test_corrwith_with_objects(self, using_infer_string):
df1 = DataFrame(
np.random.default_rng(2).standard_normal((10, 4)),
Expand All @@ -342,9 +339,8 @@ def test_corrwith_with_objects(self, using_infer_string):
df2["obj"] = "bar"

if using_infer_string:
import pyarrow as pa

with pytest.raises(pa.lib.ArrowNotImplementedError, match="has no kernel"):
msg = "Cannot perform reduction 'mean' with string dtype"
with pytest.raises(TypeError, match=msg):
df1.corrwith(df2)
else:
with pytest.raises(TypeError, match="Could not convert"):
Expand Down

0 comments on commit e53967b

Please sign in to comment.