Array to DataFrames Columns. convert(Array{Float64,1}, a)

Would you help me?
It seems very easy.

There is error: Cannot convert an object of type Array{Int,2} to an object of type Int

a=DataFrame(a=[1,2],c=[3,4],d=[5,6])
a[:,[:c ,:d]] = [1 2; 3 4]

This works as expected if you check out DataFrames#master package version (we were going through a deprecation period).

If you prefer to stick to 0.19.3 version you should follow the error message recommendation and use broadcasting:

julia> a[:,[:c ,:d]] .= [1 2; 3 4]
2×2 SubDataFrame
│ Row │ c     │ d     │
│     │ Int64 │ Int64 │
├─────┼───────┼───────┤
│ 1   │ 1     │ 2     │
│ 2   │ 3     │ 4     │

julia> a
2×3 DataFrame
│ Row │ a     │ c     │ d     │
│     │ Int64 │ Int64 │ Int64 │
├─────┼───────┼───────┼───────┤
│ 1   │ 1     │ 1     │ 2     │
│ 2   │ 2     │ 3     │ 4     │

Also note that in the past this operation was not allowed at all (that is why you get an error).

I am sorry to stupid question. How can I check the version?
Unfortunately, your code doesn’t work (I have tried it early too, and right now again).
There is error.

MethodError: no method matching copyto!(::DataFrame, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Tuple{Base.OneTo{Int64},Base.OneTo{Int64}},typeof(identity),Tuple{Array{Int64,2}}})
Closest candidates are:
copyto!(!Matched::AbstractArray, ::Base.Broadcast.Broadcasted) at broadcast.jl:797
copyto!(!Matched::AbstractArray, ::Any) at abstractarray.jl:666
materialize!(::DataFrame, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Nothing,typeof(identity),Tuple{Array{Int64,2}}}) at broadcast.jl:756
top-level scope at none:0

Use:

julia> using Pkg

julia> Pkg.status("DataFrames")
    Status `C:\Users\bogum\.julia\environments\v1.2\Project.toml`
  [a93c6f00] DataFrames v0.19.3

And you should get the same version. If not run:

Pkg.update("DataFrames")

to get the latest released version.

For some reasons I have only v0.18.4

Can it be due to Julia version 1.1.1

Is there other methods to do the same things?

thank you in advance

Then do:

a[:,[:c ,:d]] = DataFrame([1 2; 3 4], [:c, :d])

but this is not a recommended style in the long run as it is not efficient.

Thank you.