How to convert a DataFrameRow to an Array?

How can I convert a DataFrameRow to an Array? In Julia 1.5.3, I had successfully used the following approach:

df = DataFrame(Array{Float64}(undef,2,2),:auto)
row1 = convert(Vector,df[1,:])

But in 1.6.1, this no longer seems to work for me. I get the following error:

MethodError: Cannot `convert` an object of type DataFrameRow{DataFrame, DataFrames.Index} to an object of type Float64
Closest candidates are:
  convert(::Type{T}, ::Gray24) where T<:Real at C:\Users\Michael\.julia\packages\ColorTypes\7OlxI\src\conversions.jl:114
  convert(::Type{T}, ::Gray) where T<:Real at C:\Users\Michael\.julia\packages\ColorTypes\7OlxI\src\conversions.jl:113
  convert(::Type{T}, ::Unitful.Gain) where T<:Real at C:\Users\Michael\.julia\packages\Unitful\PcVKX\src\logarithm.jl:62
  ...

Stacktrace:
 [1] top-level scope
   @ In[131]:4
 [2] eval
   @ .\boot.jl:360 [inlined]
 [3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base .\loading.jl:1094

Has the ability to use convert on DataFrameRows been deprecated? And what would be a workaround for v1.6?

use Array(df[1, :])

1 Like

You can use collect.

1 Like

Thank you!

Thank you, @pdeffebach !