You can use tfds.as_dataframe
:
import tensorflow_datasets as tfds
import pandas as pd
iris_dataset, info = tfds.load('iris', with_info=True, split='train')
df = tfds.as_dataframe(iris_dataset, info)
df[['feature1','feature2', 'feature3', 'feature4']] =
pd.DataFrame(df['features'].tolist(), index= df.index)
df = df.drop('features', axis=1)
df.head()
label feature1 feature2 feature3 feature4
0 0 5.1 3.4 1.5 0.2
1 2 7.7 3.0 6.1 2.3
2 1 5.7 2.8 4.5 1.3
3 2 6.8 3.2 5.9 2.3
4 0 5.2 3.4 1.4 0.2
Or more generally, just turn the dataset into a NumPy array to use it with another library.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…