diff --git a/py-polars/Cargo.lock b/py-polars/Cargo.lock index d093e9ebfc8c..895d3a7a2e1d 100644 --- a/py-polars/Cargo.lock +++ b/py-polars/Cargo.lock @@ -1699,6 +1699,7 @@ dependencies = [ "hashbrown 0.14.0", "num-traits", "once_cell", + "polars-error", "rayon", "smartstring", "sysinfo", diff --git a/py-polars/polars/series/series.py b/py-polars/polars/series/series.py index 3b4fbf31a14d..8353d19b1170 100644 --- a/py-polars/polars/series/series.py +++ b/py-polars/polars/series/series.py @@ -3635,9 +3635,18 @@ def to_numpy( use_pyarrow: bool = True, ) -> np.ndarray[Any, Any]: """ - Convert this Series to numpy. This operation clones data but is completely safe. + Convert this Series to numpy. - If you want a zero-copy view and know what you are doing, use `.view()`. + This operation may clone data but is completely safe. Note that: + + - data which is purely numeric AND without null values is not cloned; + - floating point ``nan`` values can be zero-copied; + - booleans can't be zero-copied. + + To ensure that no data is cloned, set ``zero_copy_only=True``. + + Alternatively, if you want a zero-copy view and know what you are doing, + use `.view()`. Parameters ----------