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 import numpy as np arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']] tuples = list(zip(*arrays)) index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second']) series = pd.Series(np.random.randn(8), index=index) print(series.to_json())
Output:
{"["bar","one"]":-0.0591166327,"["bar","two"]":0.871145093,"["baz","one"]":0.61280938,"["baz","two"]":0.3848564991,"["foo","one"]":-0.8986592304,"["foo","two"]":-0.4631529084,"["qux","one"]":-1.3482521044,"["qux","two"]":0.5209236198}
The output contains unescaped quotation marks, which makes the output invalid json.
Quote marks should be escaped, for example:
{"[\"bar\",\"one\"]":-0.0591166327,"[\"bar\",\"two\"]":0.871145093,"[\"baz\",\"one\"]":0.61280938,"[\"baz\",\"two\"]":0.3848564991,"[\"foo\",\"one\"]":-0.8986592304,"[\"foo\",\"two\"]":-0.4631529084,"[\"qux\",\"one\"]":-1.3482521044,"[\"qux\",\"two\"]":0.5209236198}
pd.show_versions()
I reproduced it in pandas install from master:
pandas: 0.19.0+401.g8452080 nose: None pip: 9.0.1 setuptools: 27.2.0 Cython: 0.25.2 numpy: 1.12.0 scipy: None statsmodels: None xarray: None IPython: None sphinx: None patsy: None dateutil: 2.6.0 pytz: 2016.10 blosc: None bottleneck: None tables: None numexpr: None feather: 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 s3fs: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
thanks this was just reported and is a duplicate of #15273
welcome to do a pull request to fix!
Sorry, something went wrong.
No branches or pull requests
Code Sample
Output:
Problem description
The output contains unescaped quotation marks, which makes the output invalid json.
Expected Output
Quote marks should be escaped, for example:
Output of
pd.show_versions()
I reproduced it in pandas install from master:
pandas: 0.19.0+401.g8452080
nose: None
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.12.0
scipy: None
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: 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
s3fs: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: