-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: .describe lost CategoricalIndex info #12675
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
deprecate_kwarg) | ||
from pandas.core.missing import _clean_reindex_fill_method | ||
from pandas.core.config import get_option | ||
from pandas.indexes.base import Index | ||
from pandas.indexes.base import Index, _index_shared_docs | ||
import pandas.core.base as base | ||
import pandas.core.common as com | ||
import pandas.indexes.base as ibase | ||
|
@@ -136,6 +136,19 @@ def _simple_new(cls, values, name=None, categories=None, ordered=None, | |
result._reset_identity() | ||
return result | ||
|
||
@Appender(_index_shared_docs['_shallow_copy']) | ||
def _shallow_copy(self, values=None, categories=None, ordered=None, | ||
**kwargs): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see why this is necessary, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jreback Not now, because
|
||
# categories and ordered can't be part of attributes, | ||
# as these are properties | ||
if categories is None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its possible that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the current rules, shouldn't
|
||
categories = self.categories | ||
if ordered is None: | ||
ordered = self.ordered | ||
return super(CategoricalIndex, | ||
self)._shallow_copy(values=values, categories=categories, | ||
ordered=ordered, **kwargs) | ||
|
||
def _is_dtype_compat(self, other): | ||
""" | ||
*this is an internal non-public method* | ||
|
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 don't know if we have
_shallow_copy
defined for any other classes if so need to add docs like u did here