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

[WIP] Use df.to_json(orient='table') #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

gnestor
Copy link
Owner

@gnestor gnestor commented Mar 4, 2017

Depends on pandas 0.20.0: pandas-dev/pandas#14904

@gnestor gnestor changed the title Use df.to_json(orient='table' Use df.to_json(orient='table') Mar 4, 2017
return data.to_dict(orient='records')
if isinstance(data, pd.DataFrame):
data = sanitize_dataframe(data)
data = data.to_json(orient='table')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

data = sanitize_dataframe(data)
return data.to_dict(orient='records')
if isinstance(data, pd.DataFrame):
data = sanitize_dataframe(data)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the sanitization code end up in pandas?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sanitize_dataframe code comes from the original jupyterlab_vega which used to_dict(orient='records'). I think that to_json should take care of our sanitization needs?

@gnestor gnestor changed the title Use df.to_json(orient='table') [WIP] Use df.to_json(orient='table') Mar 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants