Type object 'Dataset' has no attribute 'from_pandas'

I am trying to create a dataset from a Pandas dataframe,. follwoing this documentation
When I run the code:

from datasets import Dataset
my_dataset = Dataset.from_pandas(df['text','encodings'])

I get this error:

AttributeError: type object 'Dataset' has no attribute 'from_pandas'

I would like to know why I have this kind error.

Hi! Which version of datasets are you using? You can check this with:

import datasets

I am using the 2.1.0 version

Version 2.1.0 comes with that method.

If no other code is in between from datasets import Dataset and my_dataset = Dataset.from_pandas(df['text','encodings']), e.g., an import, such as Torch Dataset, that could overshadow HF Dataset, something is off with your environment, so it’s best to delete it and create a new one.