-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Inconsistent dtype of category in empty Series between dict and list input #18515
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
Comments
dupe of #17261 |
This takes a separate fix, so let's keep this open?
|
The inconsistency is precisely the one described in my opening example. Which is what I'm fixing in #18496 (and has nothing to do with passing an array - which would rightly keep its dtype). But you are right that this can be considered separate from #17261, which doesn't involve categories. @jreback probably just viewed this as included in that (which was fine to me - but the fix is distinct). So OK with reopening, I will just mention in #18496 that it closes this. |
No, you are describing it with Series, which is something different as with Categorical :-) Anyhow, yes consider this as a separate issue, and mention it in #18496 (+ adding new tests, whatsnew note) |
Indeed. This issue has nothing to do with (non-
OK |
No, the inconsistency I describe is the underlying reason for the bug you reported in this issue. Of course, the actual cause is in the implementation detail how Series handles no data or empty dict, previously it was passed as np.array([]), now you changed that to be passed as []. Which you are fixing, so perfect! |
Code Sample, a copy-pastable example if possible
Problem description
The difference is unjustified.
Expected Output
The same. Probably
Out[4]:
, which is also (implicitly) tested.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.9.0-4-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
pandas: 0.22.0.dev0+241.gf745e52e1
pytest: 3.0.6
pip: 9.0.1
setuptools: 33.1.1
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.18.1
pyarrow: None
xarray: None
IPython: 5.2.2
sphinx: None
patsy: 0.4.1+dev
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: 1.2.0
tables: 3.3.0
numexpr: 2.6.1
feather: 0.3.1
matplotlib: 2.0.0
openpyxl: 2.3.0
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: None
lxml: 3.7.1
bs4: 4.5.3
html5lib: 0.999999999
sqlalchemy: 1.0.15
pymysql: None
psycopg2: None
jinja2: 2.8
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: