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

feat: serialize pd.Dataframe as csv #63

Merged
merged 6 commits into from
Sep 18, 2021
Merged

feat: serialize pd.Dataframe as csv #63

merged 6 commits into from
Sep 18, 2021

Conversation

manzt
Copy link
Member

@manzt manzt commented Sep 15, 2021

Requires that gosling.[dev] for installation. If we can support this feature without the data-server (using the json data-type), but this would currently lead to embedding the full dataset multiple times in the chart definition becaused we don't support data references: gosling-lang/gosling.js#508

import gosling as gos # import registers `pd.Dataframe.gos` namespace
import pandas as pd

df = pd.Dataframe(...)
data = df.gos.csv(...)
gos.Track(data).mark_bar().encode(...)

It might be good to dig into these methods more deeply for safer serialization of dataframes: https://github.com/altair-viz/altair/blob/master/altair/utils/data.py#L178-L217

@manzt manzt changed the title feat: serialize pd. feat: serialize pd.Dataframe as csv Sep 15, 2021
@sehilyi

This comment has been minimized.

@manzt
Copy link
Member Author

manzt commented Sep 17, 2021

Thanks for pointing this out. Let me take a look!

Copy link
Member

@sehilyi sehilyi left a comment

Choose a reason for hiding this comment

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

This is an exciting feature!

I tried to replicate one of the examples that require data transformation, and using Pandas is so satisfying for this!

@manzt manzt merged commit fa54453 into main Sep 18, 2021
@manzt manzt deleted the manzt/pandas branch September 18, 2021 17:27
manzt added a commit that referenced this pull request Sep 18, 2021
* feat: add gos pandas extension

* feat: auto-detect file extension

* refactor: register pandas extension at top level

* chore: black

* fix: pretty print GoslingDataServer even if not active

* test: add df extension test
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