Estel Estel - 1 year ago 97
Python Question

How can I use my own data with TensorFlow?

I have data set like this


This size is [n][20] and format of this file is CSV. Also "n" is unknown. How can I import and use this data in with Tensorflow, in Python (Like: split train and test data).

I already looked However, still I can't import this file in my code.

Answer Source

use the standard library module csv

import csv
with open('yourfile.csv', newline='') as f:
   r = csv.reader(f)
   for row in r:
       print(row) #Each row is a list of the values in a line of your file
                  #All you have to do then is process them in tensorflow
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download