From 40a46e8083b0d6c4049aa79d6b68f21c75210ced Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Fri, 31 Jan 2025 10:58:08 -0800 Subject: [PATCH 1/3] Fix numpy data access --- python/cudf/cudf/pandas/_wrappers/numpy.py | 3 ++- python/cudf/cudf_pandas_tests/test_cudf_pandas.py | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/python/cudf/cudf/pandas/_wrappers/numpy.py b/python/cudf/cudf/pandas/_wrappers/numpy.py index d5e669cb58f..1fc53bbbaae 100644 --- a/python/cudf/cudf/pandas/_wrappers/numpy.py +++ b/python/cudf/cudf/pandas/_wrappers/numpy.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. +# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. # All rights reserved. # SPDX-License-Identifier: Apache-2.0 @@ -149,6 +149,7 @@ def ndarray__array_ufunc__(self, ufunc, method, *inputs, **kwargs): # Special wrapping to handle scalar values "_fsproxy_wrap": classmethod(wrap_ndarray), "base": _FastSlowAttribute("base", private=True), + "data": _FastSlowAttribute("data", private=True), }, ) diff --git a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py index 938d22de076..3e8b6d5786c 100644 --- a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py +++ b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py @@ -1927,3 +1927,12 @@ def test_series_dtype_property(): expected = np.dtype(s) actual = np.dtype(xs) assert expected == actual + + +def test_numpy_data_access(): + s = pd.Series([1, 2, 3]) + xs = xpd.Series([1, 2, 3]) + expected = s.values.data + actual = xs.values.data + + assert type(expected) is type(actual) From d62ab47c597df68f7ee06ddc351eb2f3b41b6769 Mon Sep 17 00:00:00 2001 From: GALI PREM SAGAR Date: Fri, 31 Jan 2025 13:45:32 -0600 Subject: [PATCH 2/3] Update numpy.py --- python/cudf/cudf/pandas/_wrappers/numpy.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/cudf/cudf/pandas/_wrappers/numpy.py b/python/cudf/cudf/pandas/_wrappers/numpy.py index 1fc53bbbaae..45235e2b2ff 100644 --- a/python/cudf/cudf/pandas/_wrappers/numpy.py +++ b/python/cudf/cudf/pandas/_wrappers/numpy.py @@ -2,6 +2,7 @@ # All rights reserved. # SPDX-License-Identifier: Apache-2.0 + from __future__ import annotations import cupy From 076606ac06705120a17b16a92961a89431a2aaa3 Mon Sep 17 00:00:00 2001 From: GALI PREM SAGAR Date: Fri, 31 Jan 2025 13:45:45 -0600 Subject: [PATCH 3/3] Update numpy.py --- python/cudf/cudf/pandas/_wrappers/numpy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/cudf/cudf/pandas/_wrappers/numpy.py b/python/cudf/cudf/pandas/_wrappers/numpy.py index 45235e2b2ff..1fc53bbbaae 100644 --- a/python/cudf/cudf/pandas/_wrappers/numpy.py +++ b/python/cudf/cudf/pandas/_wrappers/numpy.py @@ -2,7 +2,6 @@ # All rights reserved. # SPDX-License-Identifier: Apache-2.0 - from __future__ import annotations import cupy