Skip to content
New issue

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

Roundtrip orient for JSON #9146

Komnomnomnom opened this Issue Dec 24, 2014 · 3 comments


None yet
3 participants
Copy link

Komnomnomnom commented Dec 24, 2014

Add a round-trippable json orient (maybe "roundtrip") to provide enough metadata to reconstruct a frame or series with 100% fidelity. As discussed in #9130


This comment has been minimized.

Copy link
Contributor Author

Komnomnomnom commented Dec 24, 2014

This could also support multi-level indexes and panels etc.


This comment has been minimized.

Copy link

cpcloud commented Dec 24, 2014

@jreback and i are currently using a schema that looks somewhat like this:

schema = {
    'pandas': {
        'type': 'DataFrame',
        'version': pd.__version__,
        'orient': 'records',
        'date_unit': 'ms',
        'values': df,
        'dtypes': {
            'str': [dtype.str for dtype in dtypes],
            'characters': [dtype.char for dtype in dtypes],
            'kind': [dtype.kind for dtype in dtypes]
        'axes': {
            'columns': {
                'values': df.columns.values,
                'dtype': df.columns.dtype.str,
                'names': df.columns.names
            'index': {
                'values': df.index.values,
                'dtype': df.index.dtype.str,
                'names': df.index.names

@jreback jreback added this to the 0.16.0 milestone Dec 24, 2014


This comment has been minimized.

Copy link

jreback commented Dec 24, 2014


the idea is the encompas enough meta data to really make a DataFrame round tripable w/o passing anything, IOW, making it a fully-capable format. Of course its a 'user-made' one, but that is true with lots of formats.

I suspect lots of people have already implemented this (painfully) by creating their own formats. This is basically trying to set a standard, in that, pandas objects become JSON serializable in a well-defined format.

This can be done simply by using with this format on the writing. @cpcloud mentioned that it might be necessary to support some sniffing the reader to de-serialize this format (e.g. look for the pandas tag then use the meta-data to set the next part of the serialization options).

The idea of the format is that it is pretty straightforward to extend to Series/Panel/Multi-Index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.