-
- Notifications
You must be signed in to change notification settings - Fork 19.3k
BUG: preserve name in set_categories (#17509) #17517
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits Select commit Hold shift + click to select a range
42b1c7d FIX for set_categories issue #17509
Giftlin 3843746 FIX for set_categories issue #17509
Giftlin 4f731cf FIX for set_categories issue #17509
Giftlin a4ba634 Update categorical.py
Giftlin b817366 Update categorical.py
Giftlin aa782dd Test for the changes
Giftlin 70089a4 Merge pull request #2 from Giftlin/patch-7
Giftlin 4c30c96 Space removed
Giftlin 42afe67 - Bug in preserving name in set_categories. (:issue:`17509`)
Giftlin 73a6713 Merge pull request #3 from Giftlin/patch-10
Giftlin 8f888ef Update v0.21.0.txt
Giftlin f09c9d5 Update test_categorical.py
Giftlin 8781d64 Update v0.21.0.txt
Giftlin 2ed3740 Update test_categorical.py
Giftlin 8192515 Update test_categorical.py
Giftlin 9007df3 Update v0.21.0.txt
Giftlin 72c9ebe Update v0.21.0.txt
Giftlin 90ff725 Update test_categorical.py
Giftlin 9e737c8 Merge pull request #4 from Giftlin/Giftlin-param_test_categorical.py
Giftlin f44a09a Update v0.21.0.txt
Giftlin 3b40433 Lint error fix
Giftlin b9ab8d3 Merge pull request #5 from Giftlin/Giftlin-lint-error-patch
Giftlin e21fe08 Removed space
Giftlin 9730757 Lint error
Giftlin 1749a1c Merge pull request #6 from Giftlin/Giftlinlint
Giftlin 5ae2453 Update test_categorical.py
Giftlin 9f25ad9 Update test_categorical.py
Giftlin 6b4f0f2 Update test_categorical.py
Giftlin 68a2d86 Update v0.21.0.txt
Giftlin a94d52a Update v0.21.0.txt
Giftlin 73f5241 Update categorical.rst
Giftlin f6e8aa9 Merge pull request #9 from Giftlin/Giftlin-patch-1-1
Giftlin d4bbe27 Merge pull request #7 from Giftlin/Giftlin-whatsnew
Giftlin 7bb3378 Update test_categorical.py
Giftlin 7f5ec9b Merge pull request #10 from Giftlin/Giftlin-test_categorical.py-1
Giftlin ce78e6c small edits
jorisvandenbossche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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, I misread the earlier.
selfis the instance ofCategoricalAccessor, not theSerieslike I expected. So this approach won't work.Uh oh!
There was an error while loading. Please reload this page.
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.
I think if you modify
pandas/pandas/core/categorical.py
Line 2078 in f11bbf2
data.name. and then modifyCategoricalAccessor.__init__to accept a name.datamay not have a name, so maybegetattr(data, 'name', None). Make sense?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.
so the signature should follow like we do in
pandas.core.indexes.accessors, e.g.(data, index, name=None)