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':'a', 'B':'b'} ]).groupby( ['A','B'] ).apply( lambda x: x.to_dict(orient='records') ).to_json()
produces an invalid JSON string:
'{"["a","b"]":[{"A":"a","B":"b"}]}'
For the given transformation, the output of to_json of a pandas.core.series.Series is not a valid JSON object.
to_json
pandas.core.series.Series
Would be nice if it was.
'{"[\'a\',\'b\']":[{"A":"a","B":"b"}]}'
pd.show_versions()
commit : None python : 3.7.5.final.0 python-bits : 64 OS : Linux OS-release : 4.19.84 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8
pandas : 0.25.2 numpy : 1.17.3 pytz : 2019.3 dateutil : 2.8.0 pip : None setuptools : None Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.4.1 html5lib : 1.0.1 pymysql : None psycopg2 : None jinja2 : None IPython : 7.8.0 pandas_datareader: None bs4 : 4.8.1 bottleneck : 1.2.1 fastparquet : None gcsfs : None lxml.etree : 4.4.1 matplotlib : None numexpr : 2.7.0 odfpy : None openpyxl : 3.0.0 pandas_gbq : None pyarrow : None pytables : None s3fs : None scipy : 1.3.1 sqlalchemy : 1.3.10 tables : None xarray : None xlrd : 1.2.0 xlwt : 1.3.0 xlsxwriter : None
The text was updated successfully, but these errors were encountered:
Seems to work fine in master, output: '{"(\'a\', \'b\')":[{"A":"a","B":"b"}]}'
'{"(\'a\', \'b\')":[{"A":"a","B":"b"}]}'
Sorry, something went wrong.
Interesting, I can for sure reproduce this issue with 0.25.2. So how do we go forward with this issue? Do you want me to close this?
It does reproduce in 0.25.2 and also 0.25.3. I believe this is a duplicate of #20500 and closed by #27618, so yeah, it can be closed.
k, thx.
No branches or pull requests
Code Sample, a copy-pastable example if possible
produces an invalid JSON string:
'{"["a","b"]":[{"A":"a","B":"b"}]}'
Problem description
For the given transformation, the output of
to_json
of apandas.core.series.Series
is not a valid JSON object.Would be nice if it was.
Expected Output
'{"[\'a\',\'b\']":[{"A":"a","B":"b"}]}'
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.5.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.84
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.2
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.0
pip : None
setuptools : None
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.1
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.8.0
pandas_datareader: None
bs4 : 4.8.1
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : None
numexpr : 2.7.0
odfpy : None
openpyxl : 3.0.0
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.1
sqlalchemy : 1.3.10
tables : None
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : None
The text was updated successfully, but these errors were encountered: