gpt4 book ai didi

excel - 在 Julia 中从数据框转到 excel 文件时出错

转载 作者:行者123 更新时间:2023-12-01 22:56:44 25 4
gpt4 key购买 nike

我正在尝试将数据框导出到 xlsx

df |> XLSX.writexlsx("df.xlsx")

我收到这个错误:

ERROR: Unsupported datatype String31 for writing data to Excel file. Supported data types are Union{Missing, Bool, Float64, Int64, Dates.Date, Dates.DateTime, Dates.Time, String} or XLSX.CellValue.

我无法使用 Google 找到有关 String31 的任何信息。是否需要事先对 df 执行“转换”?

最佳答案

目前看来这是 XSLX.jl 的限制。我打开了an issue提议修复它。

我假设您的 df 不是很大,在这种情况下,以下解决方案应该适合您:

to_string(x::AbstractString) = String(x)
to_string(x::Any) = x
XLSX.writetable("df.xlsx", to_string.(df))

关于excel - 在 Julia 中从数据框转到 excel 文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72955139/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com