I have an array of 31 arrays, each with 3 items in it. first two items are strings, third is a float. I just want to transform this into a Julia DataFrame and export to CSV. Just calling the DataFrame method gave me a 1 column dataframe with the entire row as one column. Can someone help me with this?
df = DataFrame(col1 = String[], col2 = String[], col3 = Float64[])
for v in array_of_vectors
push!(df, v)
end
The reason this is a bit awkward is that it’s recommended that you store your “rows”- so to speak, as named tuples rather than vectors. If you store them as named tuples you can just do
df = DataFrame()
for v in arra_of_named_tuples
push!(df, v)
end
EDIT: furthermore, if you have an array of named tuples you can just call