julia - CSV.write() 不会取任何值
问题描述
我正在尝试将 Julia 数据框导出为 CSV,但它不包含任何值。为了简化假设我有以下数据框:
using DataFrames, CSV
df = DataFrame(A = [nothing,2,3], B = [4,5,nothing])
当我尝试导出时,出现以下错误:
df |> CSV.write("df.csv")
ArgumentError: `nothing` should not be printed; use `show`, `repr`, or custom output instead.
我应该将无值转换为其他值吗?如果是这样,我将如何编码?
解决方案
您可以使用something
函数转换nothing
为您想要的任何内容(例如missing
),如下所示:
something.(df, missing) |> CSV.write("aaa.txt")
此处nothing
给出了在编写 CSV 文件时不支持设计的当前原因。
推荐阅读
- android - 如果模式设置为时间,则 DateTimePicker 不会在 android 中为 react-native 应用程序打开
- javascript - 我有 2 个状态,但即使我只 setState 其中一个,它们都在更新
- python - 任何可用于在 Python 中开发移动应用程序的框架?
- azure - Azure 认知搜索引发 System.NullReferenceException
- php - 如何在特征中键入提示“$this”属性
- flutter - 未找到 Flutter 网络图像图像
- android - ItemTouchHelper.Callback.getDefaultUIUtil().onDraw() 改变 z-index
- c# - 如何使用启动表单应用程序打开 API 控制器?
- node.js - 如何在自定义 Jest 节点环境中使用 ES6?
- python - 如何查找用户在服务器 Discord.py 中发送的消息数