Skip to content

New orientation for to_json method #5729

Closed
@julius-datajunkie

Description

@julius-datajunkie
start = datetime.datetime(2013, 1, 1)
end = datetime.datetime(2013, 01, 27)
f=web.get_data_yahoo('AAPL',start, end)
f['Adj Close'].to_json(date_format='iso',orient='split')

The above code gives the following result:

'{"name":"Adj Close","index":["2013-01-02T00:00:00","2013-01-03T00:00:0
0","2013-01-04T00:00:00","2013-01-07T00:00:00","2013-01-08T00:00:00","2013-01-09
T00:00:00","2013-01-10T00:00:00","2013-01-11T00:00:00","2013-01-14T00:00:00","20
13-01-15T00:00:00","2013-01-16T00:00:00","2013-01-17T00:00:00","2013-01-18T00:00
:00","2013-01-22T00:00:00","2013-01-23T00:00:00","2013-01-24T00:00:00","2013-01-
25T00:00:00"],"data":[535.58,528.82,514.09,511.06,512.44,504.43,510.68,507.55,48
9.45,474.01,493.69,490.36,487.75,492.4,501.41,439.46,429.1]}'

What I want is:

'[{"index":"2013-01-02T00:00:00",value:535.58},{"index":"2013-01-04T00:00:00",value:528.82},...]'

This is useful when using D3JS, and potentially many more places.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions