-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: setting new items with .loc doesn't work for constant sequences #7787
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
what are you using this for? a |
I have a very long sequence and a function that produces a dict with several keys and values (features) for samples from that sequence.
I wanted to make a DataFrame with 100 samples in rows and two columns ('a', 'b'). |
you can do with with tuples (as a value in an index). |
I have to consider (1, 2, 3), (1, 1, 2, 3) and (1, 3, 2) equal. I solved this with coding (marshal.dumps and marshal.loads). I'm just pointing out at inconsistency in API. |
Tuples have a special meaning in .loc |
you would need a custom index type for this then and maybe some modifications to the indexing code. If you'd like to submit a pull-request, would be fine. |
The API for indexing is not clear that this is supported at all (in fact, IIRC, only: |
I think a warning should be rised when someone uses a value of another type in the index. |
If you can do it w/o sacrificing speed and appropriate test, then we would take it. |
this is a very thorny problem and basically breaks indexing. |
I believe we are moving away from making the indexing code more permissive to indexing types such as |
One can construct DataFrame with frozensets in the index:
Setting new values for existing items works:
But new items cannot be created:
The text was updated successfully, but these errors were encountered: