We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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 df2 = pd.DataFrame({'a': [1], 'a b': [2]}) df2.to_dict(orient="records")
If a dataframe header contains two fields that start with the same substring, followed by whitespace, the header is not used as dict-key.
An example explains it best:
The expected output (works with 0.23.4) is
[{'a': 1, 'a b': 2}]
The actual output with 0.24.0 is
[{'a': 1, '_1': 2}]
Notice, that the second key is now _1 and not a b as expected
_1
a b
pd.show_versions()
pandas: 0.24.0 pytest: None pip: 19.0.1 setuptools: 40.6.3 Cython: None numpy: 1.16.0 scipy: None pyarrow: None xarray: None IPython: 7.2.0 sphinx: None patsy: None dateutil: 2.7.5 pytz: 2018.9 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: None openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml.etree: None bs4: None html5lib: None sqlalchemy: None pymysql: None psycopg2: None jinja2: None s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None gcsfs: None
The text was updated successfully, but these errors were encountered:
Based off the title, I'm guessing this was fixed by #24965. Will be doing a release with that soon.
Sorry, something went wrong.
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Code Sample, a copy-pastable example if possible
Problem description
If a dataframe header contains two fields that start with the same substring, followed by whitespace, the header is not used as dict-key.
An example explains it best:
The expected output (works with 0.23.4) is
The actual output with 0.24.0 is
Notice, that the second key is now
_1
and nota b
as expectedOutput of
pd.show_versions()
pandas: 0.24.0
pytest: None
pip: 19.0.1
setuptools: 40.6.3
Cython: None
numpy: 1.16.0
scipy: None
pyarrow: None
xarray: None
IPython: 7.2.0
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.9
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: