Issue
I am reading a csv file into a pandas dataframe.
train_data = pd.read_csv('mnist_test.csv');
Sample data
label pixel1 pixel2 pixel3 ... pixel781 pixel782 pixel783 pixel784
0 6 149 149 150 ... 106 112 120 107
1 5 126 128 131 ... 184 184 182 180
2 10 85 88 92 ... 226 225 224 222
3 0 203 205 207 ... 230 240 253 255
4 3 188 191 193 ... 49 46 46 53
how can I convert this dataframe into a tensorflow dataset.
Solution
import tensorflow as tf
ds = tf.data.Dataset.from_tensor_slices(dict(train_data))
See tensorflow.org/tutorials/load_data/pandas_dataframe for details.
Answered By - proedig
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.