-1
在示例中。手動給出數據集中列的變量。 但我的數據集已經有名稱作爲標題。我想用它們。如何使用python使用張量流獲取.csv文件的標題名稱?讀取張量流的csv文件
import tensorflow as tf
filename_queue=tf.train.string_input_producer(
['final_data1.csv'],num_epochs=1)
#to reada the csv file-----
print(5)
reader = tf.TextLineReader(skip_header_lines=1)
print(4)
_, csv_row = reader.read_up_to(filename_queue)
print(type(csv_row))
print(3)
with tf.Session() as sess:
print(reader.num_records_produced())
tf.global_variables_initializer()
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord = coord)'
謝謝安德烈,我之前也是這樣做的。但現在,我想在張量流中進行分類。我通過它讀取數據,如使用TextLineReader的示例中所示。但是,當我試圖獲取記錄號並獲取csv文件的標題時,它顯示爲零,我不知道如何獲取數據。 –
你可以在你的文章中添加你寫的代碼嗎?它可能會更容易幫助你。 –