-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: codes
array of a categorical Series is not writeable and prevents running __dlpack__()
on __dataframe__()
outputs
#48393
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
Comments
BTW, the fact that |
Note that the pandas
|
@ogrisel I missed a much simpler explanation of why the pandas/pandas/core/arrays/categorical.py Lines 765 to 783 in ddf2541
So this is done on purpose, and already like that for many years. It still blocks the usage of |
+1 for a quick workaround. |
codes
array of a categorical Series is not writeablecodes
array of a categorical Series is not writeable and prevents running __dlpack__ on __dataframe__ outputs
codes
array of a categorical Series is not writeable and prevents running __dlpack__ on __dataframe__ outputscodes
array of a categorical Series is not writeable and prevents running __dlpack__()
on __dataframe__()
outputs
A workaround seems reasonable here - the A quick search says that there's only a couple of usages of
The if not x.flags.writeable:
x = x.copy() and the So I think that |
@jorisvandenbossche do you think this should be a blocker for the 1.5 release planned for this week (I see you set the milestone)? |
It's certainly not a blocker, but given this is a new feature in 1.5, I certainly consider it a useful fix for 1.5 (or 1.5.x), so would like to somehow track that through the milestones. |
It's also only a tiny change, so quickly opened #48419 |
Cool, makes sense, thanks for the clarification! |
Doesn't look like merging #48419 didn't close this issue for some reason, so doing so manually. |
Reproducible Example
Issue Description
Speaking with @jorisvandenbossche, it seems that this is not intentional and might be caused by the used of theWrong, see: #48393 (comment)readonly
type specialization in the Cython code of the categorical Series.The fact that this is not writeable makes it impossible to leverage the
__dlpack__()
method of the buffers returned by the__dataframe__()
interop method because under the hood it would result in calling:Expected Behavior
Have the
.codes
array be writeable, even if the .codes attribute itself is not mutable in the Cython class.Installed Versions
The text was updated successfully, but these errors were encountered: