Dataframe Julia数据帧中的左外部联接问题
这件事把我难住了 我试图在Julia中加入两个数据帧,但我得到了这个wierd'nothing'错误。这在另一台机器上工作,所以我认为可能是包装问题。I Pkg.rm()完成所有操作并重新安装,但无法继续 朱莉娅v1.2Dataframe Julia数据帧中的左外部联接问题,dataframe,join,julia,Dataframe,Join,Julia,这件事把我难住了 我试图在Julia中加入两个数据帧,但我得到了这个wierd'nothing'错误。这在另一台机器上工作,所以我认为可能是包装问题。I Pkg.rm()完成所有操作并重新安装,但无法继续 朱莉娅v1.2 using PyCall; using DataFrames; using CSV; using Statistics; using StatsBase; using Random; using Plots; using Dates; using Missings; using
using PyCall;
using DataFrames;
using CSV;
using Statistics;
using StatsBase;
using Random;
using Plots;
using Dates;
using Missings;
using RollingFunctions;
# using Indicators;
using Pandas;
using GLM;
using Impute;
a = DataFrames.DataFrame(x = [1, 2, 3], y = ["a", "b", "c"])
b = DataFrames.DataFrame(x = [1, 2, 3, 4], z = ["d", "e", "f", "g"])
join(a, b, on=:x, kind =:left)
屈服
ArgumentError: `nothing` should not be printed; use `show`, `repr`, or custom output instead.
Stacktrace:
[1] print(::Base.GenericIOBuffer{Array{UInt8,1}}, ::Nothing) at ./show.jl:587
[2] print_to_string(::String, ::Vararg{Any,N} where N) at ./strings/io.jl:129
[3] string at ./strings/io.jl:168 [inlined]
[4] #join#543(::Symbol, ::Symbol, ::Bool, ::Nothing, ::Tuple{Bool,Bool}, ::typeof(join), ::DataFrames.DataFrame, ::DataFrames.DataFrame) at /Users/username/.julia/packages/DataFrames/3ZmR2/src/deprecated.jl:298
[5] (::getfield(Base, Symbol("#kw##join")))(::NamedTuple{(:on, :kind),Tuple{Symbol,Symbol}}, ::typeof(join), ::DataFrames.DataFrame, ::DataFrames.DataFrame) at ./none:0
[6] top-level scope at In[15]:4
种类=:内部工作正常,但:左侧、右侧和:外部不正常。这是由Julia 1.2打印
无内容的方式引起的问题(即,它在尝试打印时出错)。如果切换到Julia 1.4.1,问题就会消失
但是,我可以看到您使用的是DataFrames.jl 0.21。在此版本中,join
函数不推荐使用。您应该使用innerjoin
、leftjoin
、righjoin
、outerjoin
等函数。然后,所有这些都将适用于Julia 1.2,例如:
julia> leftjoin(a, b, on=:x)
3×3 DataFrame
│ Row │ x │ y │ z │
│ │ Int64 │ String │ String? │
├─────┼───────┼────────┼─────────┤
│ 1 │ 1 │ a │ d │
│ 2 │ 2 │ b │ e │
│ 3 │ 3 │ c │ f │
我很高兴听到他们终于解决了那件事!