We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This might not be that useful—maybe it is just me that would like this. Let me know what you think (example below).
julia> df = DataFrame(A = [1, 2, 3, 4]) 4×1 DataFrame │ Row │ A │ │ │ Int64 │ ├─────┼───────┤ │ 1 │ 1 │ │ 2 │ 2 │ │ 3 │ 3 │ │ 4 │ 4 │ julia> Vector(df) ERROR: MethodError: no method matching Array{T,1} where T(::DataFrame) ... julia> function Vector(df::DataFrame) if isone(ncol(df)) return vec(Matrix(df)) else error("Cannot convert a multi-column dataframe to a vector.") end end Array{T,1} where T julia> Vector(df) 4-element Array{Int64,1}: 1 2 3 4
The text was updated successfully, but these errors were encountered:
This fails for matrices:
julia> x = rand(2,2) 2×2 Array{Float64,2}: 0.965899 0.90723 0.653601 0.99919 julia> Vector(x) ERROR: MethodError: no method matching Array{T,1} where T(::Array{Float64,2})
so I think it should fail for data frames.
A more natural pattern to get what you want is:
only(eachcol(df))
with the only difference that it will not copy the extracted vector as opposed to your proposal.
Sorry, something went wrong.
No branches or pull requests
This might not be that useful—maybe it is just me that would like this. Let me know what you think (example below).
The text was updated successfully, but these errors were encountered: