-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Roundtrip orient for JSON #9146
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
Comments
This could also support multi-level indexes and panels etc. |
@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
}
}
}
} |
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 The idea of the format is that it is pretty straightforward to extend to Series/Panel/Multi-Index. |
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
The text was updated successfully, but these errors were encountered: