I have the following df:
import pandas as pd
df = pd.DataFrame({"foo": ["bar", "baz"]})
How do I convert to a Huggingface Dataset?
I have the following df:
import pandas as pd
df = pd.DataFrame({"foo": ["bar", "baz"]})
How do I convert to a Huggingface Dataset?
datasets have an easy way to convert pandas dataframes to hugginface datasets:
from datasets import Dataset
dataset = Dataset.from_pandas(df)
Dataset({
features: ['foo'],
num_rows: 2
})
more info here: https://huggingface.co/docs/datasets/main/en/loading#inmemory-data