Skip to content

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