-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Correct uniqueness of index for Series #14344
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
DOC: Correct uniqueness of index for Series #14344
Conversation
It is true that labels no longer need to be unique, but they still must be hashable? |
No they don't need to be hashable currently:
Do you think we should add a check for hashable? |
try to index that and see what happens |
@jreback lol i don't know, maybe some people use series without ever indexing them? otherwise do you think we should add a check for hashable values? Or maybe edit the doco to say "for the object to support indexing, the labels must be of a hashable type"? |
So we do actually check hashable, but its fairly lazy as its somewhat to expensive to do this. The point is that this is non-idiomatic, and though may work in parts of pandas is not supported, nor recommended in any way. So if you'd like to update with a stronger warning would be great. |
@themrmax Can you update this? (leave out the hashable change for now, but you can keep the change regarding uniqueness) |
RangeIndex(len(data)) if not provided. If both a dict and index | ||
sequence are used, the index will override the keys found in the | ||
dict. | ||
Values must be hashable and the same length as data. Will default to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry about just learned how to use textwidth
in vim
Current coverage is 85.21% (diff: 100%)@@ master #14344 diff @@
==========================================
Files 140 143 +3
Lines 50632 50800 +168
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43170 43289 +119
- Misses 7462 7511 +49
Partials 0 0
|
sequence are used, the index will override the keys found in the | ||
dict. | ||
Values must be hashable and the same length as data. Will default to | ||
RangeIndex(len(data)) if not provided. If both a dict and index sequence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is too long (therefore travis is failing, we test for PEP8 (line length < 80))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry about this i got my < confused with my ≤, i'll set my linewidth to 79.
@themrmax Thanks! |
cool thanks @jorisvandenbossche yes that's clearer now ! |
closes #7808
Just wanted to fix the docstring to reflect the fact that the index labels neither need to be unique
nor hashable.