Python 如何在TensorFlow中使用自己的数据?

Python 如何在TensorFlow中使用自己的数据?,python,tensorflow,Python,Tensorflow,我有这样的数据集 2016-10-24,23.00,15.47,76.00,1015.40,0.00,0.00,100.00,26.00,100.00,100.00,0.00,6.88,186.01,12.26,220.24,27.60,262.50,14.04,2.1 2016-10-24,22.00,16.14,73.00,1014.70,0.00,0.00,10.20,34.00,0.00,2.00,0.00,6.49,176.82,11.97,201.16,24.27,249.15,7.

我有这样的数据集

2016-10-24,23.00,15.47,76.00,1015.40,0.00,0.00,100.00,26.00,100.00,100.00,0.00,6.88,186.01,12.26,220.24,27.60,262.50,14.04,2.1
2016-10-24,22.00,16.14,73.00,1014.70,0.00,0.00,10.20,34.00,0.00,2.00,0.00,6.49,176.82,11.97,201.16,24.27,249.15,7.92,0.669999 
....
....
此大小为[n][20],此文件的格式为CSV。“n”也是未知的。如何在Python中导入和使用Tensorflow中的数据(如:分割训练和测试数据)


我已经看过了。但是,我仍然无法在代码中导入此文件。

使用标准库模块
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

你可以使用熊猫图书馆

import pandas as pd
a=pd.read_csv('file.csv', header=None,index_col=0)
print a
并将int转换为numpy数组(如果需要)


谢谢,我用这个导入了这个文件。此外,我将尝试在Tensorflow中使用此选项,然后我将给出反馈,因为我不确定是否可以在Tensorflow中使用此选项。:)@Estel你对tensorflow网站上呈现的方式到底有什么问题?
a.values