codecamp

TensorFlow函数教程:tf.io.decode_csv

tf.io.decode_csv函数

别名:

  • tf.decode_csv
  • tf.io.decode_csv
tf.io.decode_csv(
    records,
    record_defaults,
    field_delim=',',
    use_quote_delim=True,
    name=None,
    na_value='',
    select_cols=None
)

定义在:tensorflow/python/ops/parsing_ops.py。

将CSV记录转换为张量。每列映射到一个张量。

RFC 4180格式适用于CSV记录。(https://tools.ietf.org/html/rfc4180)请注意,我们允许在int或float字段中使用前导和尾部空格。

参数:

  • records:一个string类型的Tensor。每个字符串都是csv中的记录/行,所有记录都应具有相同的格式。
  • record_defaults:具有特定类型的Tensor对象列表。可接受的类型有float32,float64,int32,int64,string。输入记录的每列一个张量,具有该列的标量默认值或者如果需要该列则为空向量。
  • field_delim:可选的string。默认为","。用于分隔记录中字段的char分隔符。
  • use_quote_delim:可选的bool。默认为True。如果为false,则将双引号视为字符串字段内的常规字符。
  • name:操作的名称(可选)。
  • na_value:要识别为NA/NaN的附加字符串。
  • select_cols:可选的列索引的可选排序列表。如果指定,则仅解析并返回此列的子集。

返回:

Tensor对象列表。与record_defaults具有相同的类型。每个张量将与记录具有相同的形状。

可能引发的异常:

  • ValueError:如果任何参数格式错误。
TensorFlow函数教程:tf.io.decode_compressed
TensorFlow函数教程:tf.io.decode_gif
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }