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 df = pd.DataFrame([[1,2,3],[4,5,6]], columns=['a','b','c']) df.to_json(orient='split') # '{"columns":["a","b","c"],"index":[0,1],"data":[[1,2,3],[4,5,6]]}'
Useless index data increases dump size. Affects only orients 'split' and 'table'.
'split'
'table'
>>> df.to_json(orient='split', index=False) '{"columns":["a","b","c"],"data":[[1,2,3],[4,5,6]]}'
This resembles a bit how .to_csv(index=False) works.
.to_csv(index=False)
pd.show_versions()
pandas: 0.20.3 pytest: 2.6.4 pip: 9.0.1 setuptools: 36.2.5 Cython: None numpy: 1.13.1 scipy: 0.16.0 xarray: None IPython: 5.4.1 sphinx: None patsy: 0.4.1 dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: None tables: None numexpr: 2.6.2 feather: None matplotlib: None openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: None sqlalchemy: None pymysql: None psycopg2: 2.6 (dt dec pq3 ext lo64) jinja2: 2.7.3 s3fs: None pandas_gbq: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
this would be ok. a pull-request to implement would needed from the community for this.
Sorry, something went wrong.
I've started looking into this.
EHN: Add index parameter to to_json (pandas-dev#17394)
11c90be
03e8ec3
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Code Sample, a copy-pastable example if possible
Problem description
Useless index data increases dump size. Affects only orients
'split'
and'table'
.Expected Output
This resembles a bit how
.to_csv(index=False)
works.Output of
pd.show_versions()
pandas: 0.20.3
pytest: 2.6.4
pip: 9.0.1
setuptools: 36.2.5
Cython: None
numpy: 1.13.1
scipy: 0.16.0
xarray: None
IPython: 5.4.1
sphinx: None
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: 2.6.2
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: 2.6 (dt dec pq3 ext lo64)
jinja2: 2.7.3
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: