Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with constructor after Tables 1.8 #395

Closed
JackDunnNZ opened this issue Sep 17, 2022 · 3 comments
Closed

Error with constructor after Tables 1.8 #395

JackDunnNZ opened this issue Sep 17, 2022 · 3 comments

Comments

@JackDunnNZ
Copy link

Not sure this is the right place to file this, but after Tables 1.8 (in particular JuliaData/Tables.jl#288) the following code gives an error:

julia> using DataFrames, CategoricalArrays

julia> d = DataFrame(x=allowmissing(categorical(["a"])))

julia> vcat(d, d)
ERROR: MethodError: no method matching (CategoricalVector{Union{Missing, String}, UInt32})(::Missing, ::Int64)
Closest candidates are:
  (CategoricalArray{T, 1, R})(::UndefInitializer, ::Int64; levels, ordered) where {T, R} at ~/.julia/packages/CategoricalArrays/zg8z5/src/array.jl:191
Stacktrace:
 [1] allocatecolumn(T::Type, len::Int64)
   @ Tables ~/.julia/packages/Tables/Rophz/src/fallbacks.jl:107
 [2] _vcat(dfs::Vector{AbstractDataFrame}; cols::Symbol)
   @ DataFrames ~/.julia/packages/DataFrames/a6np0/src/abstractdataframe/abstractdataframe.jl:1871
 [3] #reduce#130
   @ ~/.julia/packages/DataFrames/a6np0/src/abstractdataframe/abstractdataframe.jl:1761 [inlined]
 [4] #vcat#129
   @ ~/.julia/packages/DataFrames/a6np0/src/abstractdataframe/abstractdataframe.jl:1679 [inlined]
 [5] vcat(::DataFrame, ::DataFrame)
   @ DataFrames ~/.julia/packages/DataFrames/a6np0/src/abstractdataframe/abstractdataframe.jl:1679
 [6] top-level scope
   @ REPL[4]:1

(docs) pkg> st -m DataFrames CategoricalArrays Tables
  [324d7699] CategoricalArrays v0.10.6
  [a93c6f00] DataFrames v1.3.5
  [bd369af6] Tables v1.8.0

It looks like a new constructor taking missing as the first arg might be needed?

@bkamins
Copy link
Member

bkamins commented Sep 17, 2022

see JuliaData/Tables.jl#298 (for the time being, before the issue is resolved, I recommend you implement this patch to make things work)

@bkamins
Copy link
Member

bkamins commented Sep 17, 2022

The constructor you mention still might be added. Let us see what @nalimilan decides.

@nalimilan
Copy link
Member

Yes we could implement that constructor (though in practice it would be completely identical to the undef one). But please file a separate issue if you're interested in it, as this one mentions an error with Tables.jl which is now fixed there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants