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
import pandas as pd pd.DataFrame([{'a-1': 34087, 'b': 'blablabla', 'c': 55}]).to_dict(orient='records') # Out: [{'_0': 34087, 'b': 'blablabla', 'c': 55}]
The behaviour of to_dict(orient='records') has changed in version 0.24. In all previous versions the result of the above test is:
to_dict(orient='records')
[{'a-1': 34087, 'b': 'blablabla', 'c': 55}]
but the current result is:
[{'_0': 34087, 'b': 'blablabla', 'c': 55}]
The keys with hyphens are renamed to "_" + number.
The same as in the previous versions of Pandas:
pd.show_versions()
commit: None python: 2.7.6.final.0 python-bits: 64 OS: Linux OS-release: 4.4.0-36-lowlatency machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: None.None
pandas: 0.24.0 pytest: 4.0.2 pip: 18.1 setuptools: 40.7.1 Cython: 0.29.3 numpy: 1.16.0 scipy: 0.18.1 pyarrow: None xarray: None IPython: 5.8.0 sphinx: None patsy: 0.4.1 dateutil: 2.5.3 pytz: 2016.7 blosc: 1.5.1 bottleneck: 1.2.1 tables: 3.4.2 numexpr: 2.6.9 feather: None matplotlib: 2.2.2 openpyxl: 2.5.12 xlrd: 1.2.0 xlwt: 1.3.0 xlsxwriter: 1.1.2 lxml.etree: 4.2.5 bs4: 4.5.3 html5lib: None sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None gcsfs: None
The text was updated successfully, but these errors were encountered:
This is fixed in master. We'll be releasing 0.24.1 in the next couple days with a fix.
Sorry, something went wrong.
No branches or pull requests
Code Sample, a copy-pastable example if possible
Problem description
The behaviour of
to_dict(orient='records')
has changed in version 0.24. In all previous versions the result of the above test is:but the current result is:
The keys with hyphens are renamed to "_" + number.
Expected Output
The same as in the previous versions of Pandas:
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-36-lowlatency
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.24.0
pytest: 4.0.2
pip: 18.1
setuptools: 40.7.1
Cython: 0.29.3
numpy: 1.16.0
scipy: 0.18.1
pyarrow: None
xarray: None
IPython: 5.8.0
sphinx: None
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.7
blosc: 1.5.1
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.9
feather: None
matplotlib: 2.2.2
openpyxl: 2.5.12
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.2
lxml.etree: 4.2.5
bs4: 4.5.3
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: