我正在使用Tensorflow 2来训练分类器。我用tensorflow.data.experimental.make_csv_dataset读取了一个非常大的csv文件(一些整型特征,一些浮点型特征和结果列)。如何使用tf.data.map将每个批次转换为pandas数据框
教程非常令人困惑。有什么建议吗?
发布于 2020-08-10 21:50:52
只是在批处理上调用pd.DataFrame?
import tensorflow as tf
import pandas as pd
ds = tf.data.experimental.make_csv_dataset('iris.csv', batch_size=8)
example = next(iter(ds))
pd.DataFrame(example) sepallength sepalwidth petallength petalwidth variety
0 5.1 3.5 1.4 0.2 b'Setosa'
1 5.9 3.2 4.8 1.8 b'Versicolor'
2 4.4 3.2 1.3 0.2 b'Setosa'
3 7.9 3.8 6.4 2.0 b'Virginica'
4 5.6 2.7 4.2 1.3 b'Versicolor'
5 5.7 2.8 4.1 1.3 b'Versicolor'
6 4.5 2.3 1.3 0.3 b'Setosa'
7 5.5 4.2 1.4 0.2 b'Setosa'https://stackoverflow.com/questions/63334894
复制相似问题