You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Apologies that this isn't strictly related to DataFrames, but I'm not sure where the fix for this needs to be)
The following code works for me when using a single thread:
using CSV, DataFrames, CategoricalArrays
data = CSV.read("kc_house_data.csv", DataFrame)
select(data, :waterfront=> categorical)
But if I run with multiple threads, it uses SentinelArrays when reading in the CSV and I get the following method ambiguity error between CategoricalArrays and SentinelArrays during the transform:
ERROR: MethodError: copyto!(::CategoricalVector{Int64, UInt32, Int64, CategoricalValue{Int64, UInt32}, Union{}}, ::SentinelArrays.ChainedVector{Int64, Vector{Int64}}) is ambiguous. Candidates:
copyto!(dest::Union{SubArray{var"#s5", N, var"#s4", I, L} where {var"#s5", var"#s4"<:(CategoricalArray{T, var"#s3", R, V, C, U} where {var"#s3", V, C, U}), I, L}, CategoricalArray{T, N, R, V, C, U} where {V, C, U}} where {T, N, R<:Integer}, src::AbstractArray) in CategoricalArrays at /Users/jack/.julia/packages/CategoricalArrays/rDwMt/src/array.jl:615
copyto!(dest::AbstractVector{T} where T, src::SentinelArrays.ChainedVector) in SentinelArrays at /Users/jack/.julia/packages/SentinelArrays/VbnBp/src/chainedvector.jl:335
Possible fix, define
copyto!(::Union{SubArray{T, 1, var"#s4", I, L} where {T, T1, R<:Integer, var"#s4"<:(CategoricalArray{T1, var"#s3", R, V, C, U} where {var"#s3", V, C, U}), I, L}, CategoricalVector{T, R, V, C, U} where {C, U, T, R<:Integer, V}}, ::SentinelArrays.ChainedVector)
Stacktrace:
[1] _convert(::Type{CategoricalVector{Int64, UInt32, V, C, U} where {V, C, U}}, A::SentinelArrays.ChainedVector{Int64, Vector{Int64}}; levels::Nothing)
@ CategoricalArrays ~/.julia/packages/CategoricalArrays/rDwMt/src/array.jl:343
[2] (CategoricalVector{Int64, UInt32, V, C, U} where {V, C, U})(A::SentinelArrays.ChainedVector{Int64, Vector{Int64}}; levels::Nothing, ordered::Bool)
@ CategoricalArrays ~/.julia/packages/CategoricalArrays/rDwMt/src/array.jl:253
[3] #categorical#72
@ ~/.julia/packages/CategoricalArrays/rDwMt/src/array.jl:927 [inlined]
[4] categorical(A::SentinelArrays.ChainedVector{Int64, Vector{Int64}})
@ CategoricalArrays ~/.julia/packages/CategoricalArrays/rDwMt/src/array.jl:926
[5] _transformation_helper(df::DataFrame, col_idx::Int64, ::Base.RefValue{Any})
@ DataFrames ~/.julia/packages/DataFrames/vuMM8/src/abstractdataframe/selection.jl:368
[6] select_transform!(::Base.RefValue{Any}, df::DataFrame, newdf::DataFrame, transformed_cols::Set{Symbol}, copycols::Bool, allow_resizing_newdf::Base.RefValue{Bool})
@ DataFrames ~/.julia/packages/DataFrames/vuMM8/src/abstractdataframe/selection.jl:546
[7] _manipulate(df::DataFrame, normalized_cs::Vector{Any}, copycols::Bool, keeprows::Bool)
@ DataFrames ~/.julia/packages/DataFrames/vuMM8/src/abstractdataframe/selection.jl:1383
[8] manipulate(df::DataFrame, cs::Any; copycols::Bool, keeprows::Bool, renamecols::Bool)
@ DataFrames ~/.julia/packages/DataFrames/vuMM8/src/abstractdataframe/selection.jl:1311
[9] select(df::DataFrame, args::Any; copycols::Bool, renamecols::Bool)
@ DataFrames ~/.julia/packages/DataFrames/vuMM8/src/abstractdataframe/selection.jl:940
[10] select(df::DataFrame, args::Any)
@ DataFrames ~/.julia/packages/DataFrames/vuMM8/src/abstractdataframe/selection.jl:940
[11] top-level scope
@ REPL[3]:1
Thank you for an excellent issue report. This is a known problem. It is tracked here JuliaData/CategoricalArrays.jl#361 (and it is good that you reported it so that we will get back to fixing it)
(Apologies that this isn't strictly related to DataFrames, but I'm not sure where the fix for this needs to be)
The following code works for me when using a single thread:
But if I run with multiple threads, it uses SentinelArrays when reading in the CSV and I get the following method ambiguity error between CategoricalArrays and SentinelArrays during the transform:
If helpful, the data is available here: kc_house_data.csv
All packages are up to date (CSV 0.9.3, DataFrames 1.2.2, CategoricalArrays 0.10.0, Sentinel Arrays 1.3.7)
The text was updated successfully, but these errors were encountered: