python - TFX。CsvExampleGen 中 CsvCoder 的属性:“列与指定的 csv 标题不匹配”
问题描述
我正在使用 TensorFlow Extended 并堆栈在加载的 .csv 文件中。此文件有;
分隔,默认无法读取 TFX 生成器CsvExampleGen()
。它抛出以下错误:ValueError: Columns do not match specified csv headers
我发现这个问题与内部依赖关系有关,例如tft.coders.CsvCoder()
不需要默认参数来解析 .csv 文件。
问题如下:
- 如何从中抛出
tft.coders.CsvCoder()
参数tfx.components.CsvExampleGen
?
from tfx.components import CsvExampleGen
from tfx.utils.dsl_utils import external_input
data_path = './data'
intro_component = CsvExampleGen(input=external_input(data_path))
...
解决方案
从评论中
当前的解决方案是使用 pandas 转换数据文件:
df = pd.read_csv(_file_path, sep=';')
df.to_csv(_file_path)
(从奥莱克斯转述)。
推荐阅读
- php - Xdebug 探查器 - 探查器快照格式不正确
- r - R:分数概率模型中的聚类标准误
- android - 如何解决 kotlin cacheconfig 错误
- java - 如何拆分包含 apache camel 中文件列表的交换并将每个文件写入文件系统
- php - Wordpress 中同一个 css 中的多个类
- javascript - Fullcalendar : 为事件显示错误的结束时间
- javascript - 带有firebase计时问题的javascript
- google-apps-script - 改善从 Google 表格发送电子邮件之前所需的条件
- pdfbox - PDFBox:通过重复添加包含表单的单页模板来填写 PDF
- batch-file - 递归重命名在批处理中根本不起作用