Skip to content

[WIP] Make Index.values read-only #33055

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

Closed
wants to merge 5 commits into from

Conversation

ivirshup
Copy link
Contributor

This is a PR for looking around enforcing immutability of pd.Index objects. It will be a draft, but the main idea is to show what tests fail and what would need to change for this to be implemented. Because of this, I'm going to add some commits incrementally, so there is a history in the build logs.

@alimcmaster1
Copy link
Member

@ivirshup are you still interested in working on this?

@ivirshup
Copy link
Contributor Author

ivirshup commented May 4, 2020

I've gotten a little stuck on the cython part. Using the cython 3.0 alpha, the errors about using a const fused type go away, but are replaced by parse errors of the generated c code. This seems to only be the case if the types are imported from numpy.

I think it could make sense for someone who has more experience with cython to take over, or at least figure out that part. I'm still interested, but I'm not sure I have the time to learn that much about cython at the moment.

@jreback
Copy link
Contributor

jreback commented Jun 14, 2020

see if you can merge master and get this passing

@ivirshup ivirshup force-pushed the index-immutability branch from c01c14b to 5014559 Compare July 21, 2020 14:19
@ivirshup ivirshup force-pushed the index-immutability branch from 5014559 to e1fda5b Compare July 21, 2020 15:22
@@ -33,6 +33,20 @@ def test_mutability(index):
index[0] = index[0]


def test_values_mutability(index):
if not len(index):
return
Copy link
Member

Choose a reason for hiding this comment

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

moot point till tests are passing, but ideally should use pytest.skip with message.

@ivirshup
Copy link
Contributor Author

@jreback, IIRC this requires cython 3. Since master can't compile with cython 3 (#34014), I think this is stuck.

@jbrockmendel
Copy link
Member

closing as inactive, we can reopen if you like after cy3 is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Idea: Make pd.Index.values not writable
5 participants