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
dtype = pd.api.types.CategoricalDtype(categories=["A","B"]) ds1 = pd.Series(data="A", index=[1,2], dtype=dtype) ds2 = pd.Series(data="A", dtype=dtype)
In the above ds1 has lost the category "B" while ds2 has retained it.
ds1
ds2
Both ds1 and ds2 should have the same dtype.
pd.show_versions()
commit: None python: 3.5.2.final.0 python-bits: 64 OS: Linux OS-release: 4.4.0-43-Microsoft machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8
pandas: 0.22.0 pytest: None pip: 9.0.1 setuptools: 20.7.0 Cython: None numpy: 1.13.3 scipy: 1.0.0 pyarrow: None xarray: None IPython: 6.2.1 sphinx: None patsy: None dateutil: 2.6.1 pytz: 2018.3 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: 2.1.1 openpyxl: 2.5.0 xlrd: 1.1.0 xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: 1.0b10 sqlalchemy: None pymysql: None psycopg2: 2.7.4 (dt dec pq3 ext lo64) jinja2: 2.8 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
Looks like this was fixed on master by #19717:
In [2]: pd.__version__ Out[2]: '0.23.0.dev0+428.gaedbd94' In [3]: dtype = pd.api.types.CategoricalDtype(categories=["A","B"]) In [4]: ds1 = pd.Series(data="A", index=[1,2], dtype=dtype) In [5]: ds1.dtype Out[5]: CategoricalDtype(categories=['A', 'B'], ordered=False) In [6]: ds1 Out[6]: 1 A 2 A dtype: category Categories (2, object): [A, B]
Sorry, something went wrong.
No branches or pull requests
Code Sample, a copy-pastable example if possible
Problem description
In the above
ds1
has lost the category "B" whileds2
has retained it.Expected Output
Both
ds1
andds2
should have the same dtype.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-43-Microsoft
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.22.0
pytest: None
pip: 9.0.1
setuptools: 20.7.0
Cython: None
numpy: 1.13.3
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2018.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.1.1
openpyxl: 2.5.0
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0b10
sqlalchemy: None
pymysql: None
psycopg2: 2.7.4 (dt dec pq3 ext lo64)
jinja2: 2.8
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: