Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add __array_interface__ to cudf.pandas numpy.ndarray proxy #15936

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

mroeschke
Copy link
Contributor

Description

closes #15926

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mroeschke mroeschke added bug Something isn't working non-breaking Non-breaking change cudf.pandas Issues specific to cudf.pandas labels Jun 5, 2024
@mroeschke mroeschke requested a review from a team as a code owner June 5, 2024 21:16
@github-actions github-actions bot added the Python Affects Python cuDF API. label Jun 5, 2024
@Matt711
Copy link
Contributor

Matt711 commented Jun 6, 2024

Hey @mroeschke, I pulled your changes to try to test them locally. The example in the issue worked for me. Do you know of another example that produces a numpy proxy ndarray other than the example in the issue (which used df.values)?

# file: reproduce.py
import cudf

print(cudf.__version__)         # 24.08.00a101

import pandas as pd
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
arr = df.values

print(arr.__cuda_array_interface__) # good
print(arr.__array_interface__)  # AttributeError

@trivialfis
Copy link
Member

produces a numpy proxy ndarray other than the example in the issue (which used df.values)

Not familiar with the internal, maybe DataFrame.to_numpy()?

Copy link
Contributor

@Matt711 Matt711 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I pulled and tested it earlier.

@mroeschke
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 139ed6c into rapidsai:branch-24.08 Jun 7, 2024
70 checks passed
@mroeschke mroeschke deleted the enh/cudf_pandas/ai branch June 7, 2024 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cudf.pandas Issues specific to cudf.pandas non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] The ndarray wrapper in cudf.pandas doesn't have __array_interface__.
3 participants