我想生成一个空的数据帧数组,稍后将在代码中填充它,但是我还没有弄清楚该怎么做。任何帮助,将不胜感激!
我尝试了定义空数组的标准方法。
julia> df = Array{DataFrame}(undef,10)
10-element Array{DataFrame,1}:
#undef
#undef
#undef
#undef
#undef
#undef
#undef
#undef
#undef
#undef
julia> println(typeof(df[1]))
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getindex(::Array{DataFrame,1}, ::Int64) at ./array.jl:729
[2] top-level scope at none:0
我希望typeof(df [1])表示DataFrame,但是它失败并显示一条错误消息。
最佳答案
尝试:
df_vector = [DataFrame() for _ in 1:10]
要么
map(_ -> DataFrame(), 1:10)
关于arrays - 如何在Julia中定义DataFrames的空数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57045718/