We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
>>> c = pd.api.types.CategoricalDtype('c b a'.split(), ordered=True) >>> c CategoricalDtype(categories=['c', 'b', 'a'], ordered=True) >>> pd.CategoricalIndex('a b b c'.split(), dtype=c) CategoricalIndex(['a', 'b', 'b', 'c'], categories=['a', 'b', 'c'], ordered=False, dtype='category')
Note that categories and ordered above do not follow the rules from c.
categories
ordered
c
Using pd.Categorical(..., dtype=c) works in v0.21, so IMO pd.CategoricalIndex(..., dtype=c) should work as well, but deosn't.
pd.Categorical(..., dtype=c)
pd.CategoricalIndex(..., dtype=c)
>>> pd.CategoricalIndex('a b b c'.split(), dtype=c) CategoricalIndex(['a', 'b', 'b', 'c'], categories=['c', 'b', 'a'], ordered=True, dtype='category')
Note that categories and ordered do follow the rules from c in this expected version.
pd.show_versions()
commit: None python: 3.6.3.final.0 python-bits: 32 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None
pandas: 0.21.0 pytest: 3.2.1 pip: 9.0.1 setuptools: 36.5.0.post20170922 Cython: None numpy: 1.11.3 scipy: None pyarrow: None xarray: None IPython: 6.1.0 sphinx: None patsy: None dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: None openpyxl: 2.4.8 xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: None sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
dtype needs to be passed thru here: https://github.com/pandas-dev/pandas/blob/master/pandas/core/indexes/category.py#L82
dtype
this case is only for list-likes (but should make sure have coverage for passing in CategoricalIndex/Categorical)
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Code Sample, a copy-pastable example if possible
Note that
categories
andordered
above do not follow the rules fromc
.Problem description
Using
pd.Categorical(..., dtype=c)
works in v0.21, so IMOpd.CategoricalIndex(..., dtype=c)
should work as well, but deosn't.Expected Output
Note that
categories
andordered
do follow the rules fromc
in this expected version.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.3.final.0
python-bits: 32
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.21.0
pytest: 3.2.1
pip: 9.0.1
setuptools: 36.5.0.post20170922
Cython: None
numpy: 1.11.3
scipy: None
pyarrow: None
xarray: None
IPython: 6.1.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: 2.4.8
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: