Skip to content

mixed data type to_json(orient='index') repeats only the first index value #10289

Closed
@sborgeson

Description

@sborgeson
from pandas import DataFrame
df = DataFrame({
    'one' : pandas.Series(['foo','bar','bee'],index=['a','b','c']),
    'two' : pandas.Series([1,2,3],index=['a','b','c'])   } )
df.to_json(orient='index')

Observe that the first index value 'a' is used for all the record returned, rather than for just the first one. I've reproduced this issue on a linux machine with the config below, but it was first observed on OSX and can reproduce it on Windows, all with pandas 0.16.1.

This issue was not present in pandas version 0.14.x

pandas.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.6.8.final.0
python-bits: 64
OS: Linux
OS-release: 2.6.18-274.el5
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.16.1
nose: None
Cython: None
numpy: 1.9.2
scipy: None
statsmodels: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.4.2
pytz: 2015.4
bottleneck: None
tables: 3.2.0
numexpr: 2.4.3
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO JSONread_json, to_json, json_normalize

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions