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

add from_pandas and from_dict #350

Merged
merged 1 commit into from
Jul 8, 2020
Merged

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Jul 7, 2020

I added two new methods to the Dataset class:

  • from_pandas() to create a dataset from a pandas dataframe
  • from_dict() to create a dataset from a dictionary (keys = columns)

It uses the pa.Table.from_pandas and pa.Table.from_pydict funcitons to do so.
It is also possible to specify the features types via features=... if there are ambiguities (null/nan values), otherwise the arrow schema is infered from the data automatically by pyarrow.

One question that I have right now:

  • Should we also add a save() method that would write the dataset on the disk ? Right now if we create a Dataset using those two new methods, the data are kept in RAM. Then to reload it we can call the from_file() method.

@lhoestq lhoestq requested a review from thomwolf July 7, 2020 15:03
Copy link
Member

@thomwolf thomwolf left a comment

Choose a reason for hiding this comment

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

Really great!

@lhoestq lhoestq merged commit 249d933 into master Jul 8, 2020
@lhoestq lhoestq deleted the add-from-pandas-and-dict-methods branch July 8, 2020 14:14
@lhoestq lhoestq mentioned this pull request Jul 20, 2020
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