tensorflow - Tensorflow TFDV 不适用于特定的 NaN 值
问题描述
我正在使用 Tensorflow 数据验证从数据中生成统计信息并推断要在 TFX 中输入的模式。
我没有找到任何指定 NaN 值的选项,例如,在 pandas 中有一个字段“na_values”,可以在其中指定读取数据时将被视为 NaN 的值。
我查看了整个 TFDV 文档,但没有找到。
tfdv.generate_statistics_from_csv(
data_location,
column_names=None,
delimiter=',',
output_path=None,
stats_options=options.StatsOptions(),
pipeline_options=None
)
options.StatsOptions() 是用于生成统计信息的选项,例如sample_count、sample_rate 等...
对我来说,读取处理缺失值的数据将数据保存为 Csv 或 TFRecord 并在导入 TFDV 后生成统计信息是没有意义的。
解决方案
In TFDV 0.13.0, you can use tfdv.generate_statistics_from_dataframe method to generate statistics from a pandas Dataframe. If your data fits in-memory, you can use pandas.read_csv method to read the CSV file (by specifying na_values) and then use the above method to generate statistics.
推荐阅读
- php - 给定一个数 N,返回能被 3 整除的最大数 <= N
- php - 根据排名查找重复项
- html - 浏览器放大/缩小是否与不同的屏幕尺寸相同?
- java - Android Studio 3.1.3 错误:java.lang.ClassNotFoundException: org.gradle.api.internal.component.Usage
- symfony - 首次设置字段的时间戳
- django - 将 django 网站运行到服务器时,“模块”对象不可迭代
- .htaccess - 使用动态查询字符串将旧格式重写为新的动态等效格式
- navision - 在 NAVISION 女士发布项目日志后,如何修改页面 (31) 项目列表
- ios - iOS 12 深度数据捕获错误代码 11800
- c++ - 在 C++ 中打印 bool 数据类型的值