Skip to content

Commit

Permalink
fix: __array__ for pandas with older pyarrow versions (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli authored Aug 21, 2024
1 parent 738e75e commit 9eba84c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions narwhals/_pandas_like/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,10 @@ def to_dict(self, *, as_series: bool = False) -> dict[str, Any]:
def to_numpy(self, dtype: Any = None, copy: bool | None = None) -> Any:
from narwhals._pandas_like.series import PANDAS_TO_NUMPY_DTYPE_MISSING

if copy is None:
# pandas default differs from Polars
copy = False

if dtype is not None:
return self._native_frame.to_numpy(dtype=dtype, copy=copy)

Expand Down

0 comments on commit 9eba84c

Please sign in to comment.