How to write a dataframe with the index column to a csv please? This is what I have put togeter but I am missing the index. (Btw, I dont even know if thats the best way. What I want, is to save a nested list of lists to a csv along with some identifier)
using CSV
using DataFrames
lis = [[1,2,3,4], [3], [5, 8]]
d = Dict( (i => [lis[i]] for i=1:length(lis)))
df = DataFrame(d)
df = DataFrame(Matrix(df)')
df = select(df, "x1" => "col_1")
CSV.write("df.csv", df, header=true)
Also note that you can transpose a data frame using permutedims. And calling a DataFrame constructor with a Matrix is deprecated. Use DataFrame(Matrix(df)', :auto).