Skip to content

to_json() Flat Output #8333

Closed
Closed
@r-barnes

Description

@r-barnes

The to_json() I/O command current provides the following output:

split   dict like {index -> [index], columns -> [columns], data -> [values]}
records list like [{column -> value}, ... , {column -> value}]
index   dict like {index -> {column -> value}}
columns dict like {column -> {index -> value}}
values  just the values array

It would be handy if the output could also be provided in the format:

mdarray    [ [index1,value1a,value1b,...] , [index2,value2a,value2b,...], ... ]

This format is, for instance, used by the DyGraphs JS library for plotting data.

The following command provides the output I am looking for:

np.column_stack((df.index,df.as_matrix())).tolist()

(where df is a DataFrame)

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