小编Leo*_* Jr的帖子

如何在 Julia 中连接 DataFrame 数组?

我试图通过连接每个 中的公共列来将DataFrames我拥有的数组减少为一个。DataFrameDataFrame

这是我迄今为止尝试过的示例:

using DataFrames

samples=[DataFrame(x=[1,2,3],y=[1,2,3]),DataFrame(x=[4,5,6],y=[4,5,6]),DataFrame(x=[7,8,9],y=[7,8,9])]

hcat(select.(samples,:y)[1],select.(samples,:y)[2],select.(samples,:y)[3],makeunique=true) #this works

hcat(select.(samples,:y),makeunique=true)    #this doesn't

Run Code Online (Sandbox Code Playgroud)

前一种解决方案的问题是samples数组可能会根据数据任意长。

似乎只为方法makeunique定义;DataFrame我需要定义一个新DataFrames hcat方法吗?或者我可以以某种方式“输入”每个内容DataFrame,以便hcat将其解释为列表DataFrames吗?

dataframe julia

2
推荐指数
1
解决办法
1509
查看次数

标签 统计

dataframe ×1

julia ×1