小编use*_*029的帖子

Tensorflow csv阅读器错误:“字符串中的引号必须由另一个引号转义”

我有一个 csv 文件,我很确定它没有 " ,我正在尝试使用以下代码阅读:

filename_queue = tf.train.string_input_producer(["../data/train_no_empty_rows.txt"])
# train_no_empty_rows

reader = tf.TextLineReader()
key, value = reader.read(filename_queue)


record_defaults = [tf.constant(['p'], dtype=tf.string),    # Column 0
               tf.constant(['p'], dtype=tf.string),    # Column 1
               tf.constant(['p'], dtype=tf.string)]   # Column 2 


col1, col2, col3 = tf.decode_csv(
value, record_defaults=record_defaults,field_delim=" ")

features = tf.pack([col2, col3])
with tf.Session() as sess:
  # Start populating the filename queue.
  coord = tf.train.Coordinator()
  threads = tf.train.start_queue_runners(coord=coord)
  for i in range(1200):
    # Retrieve a single instance:
    example, label = sess.run([features, col1])

  coord.request_stop()
  coord.join(threads)
Run Code Online (Sandbox Code Playgroud)

但是当我运行它时,我收到此错误:

InvalidArgumentError: …
Run Code Online (Sandbox Code Playgroud)

python csv tensorflow

2
推荐指数
1
解决办法
795
查看次数

标签 统计

csv ×1

python ×1

tensorflow ×1