-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Inconsistent type casting between DataFrame and Series #14216
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
Slightly simpler repro.
|
this is a duplicate of #13236 so this could be a test for that issue |
right I didn't repurpose that issue. The underlying, which is slated for 0.20 is #13258 |
Ah yes, so it is a duplicate of that one (#13258). Will add it there as case to test |
I checked out #17491 and the bug in my original code sample where to_dict() returns different types for DataFrame and Series is still reproducible. @chris-b1's code snippet is used as a test case and correctly works now, so I think there is still something in Series.to_dict() that needs to be changed to return python types, assuming that is the expected behavior. |
There is an inconsistency between how Series and DataFrames export types to dicts. The issue only manifests if the dataframe has multiple columns with different types. I think the issue is probably pretty far under the surface with differences between Series and DataFrame dtypes and just happened to be uncovered by export to dict.
Code Sample, a copy-pastable example if possible
Expected Output
OR
output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.10.final.0
python-bits: 64
OS: Darwin
OS-release: 14.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 25.2.0
Cython: None
numpy: 1.11.1
scipy: 0.13.0b1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: