Skip to content

Commit ddeee5a

Browse files
committed
Fix remaining tests
1 parent a15070f commit ddeee5a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pandas/core/arrays/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,6 +2539,14 @@ def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
25392539
if result is not NotImplemented:
25402540
return result
25412541

2542+
# TODO: putting this here is hacky as heck
2543+
if self.dtype == "float64[pyarrow]":
2544+
# e.g. test_log_arrow_backed_missing_value
2545+
new_inputs = [
2546+
x if x is not self else x.to_numpy(na_value=np.nan) for x in inputs
2547+
]
2548+
return getattr(ufunc, method)(*new_inputs, **kwargs)
2549+
25422550
return arraylike.default_array_ufunc(self, ufunc, method, *inputs, **kwargs)
25432551

25442552
def map(self, mapper, na_action: Literal["ignore"] | None = None):

pandas/tests/io/test_stata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2056,9 +2056,10 @@ def test_writer_118_exceptions(self, temp_file):
20562056
["numpy_nullable", pytest.param("pyarrow", marks=td.skip_if_no("pyarrow"))],
20572057
)
20582058
def test_read_write_ea_dtypes(self, dtype_backend, temp_file, tmp_path):
2059+
dtype = "Int64" if dtype_backend == "numpy_nullable" else "int64[pyarrow]"
20592060
df = DataFrame(
20602061
{
2061-
"a": [1, 2, None],
2062+
"a": pd.array([1, 2, None], dtype=dtype),
20622063
"b": ["a", "b", "c"],
20632064
"c": [True, False, None],
20642065
"d": [1.5, 2.5, 3.5],

0 commit comments

Comments
 (0)