JuliaData / TypedTables.jl

Simple, fast, column-based storage for data analysis in Julia
Other
147 stars 25 forks source link

Constructor from a `Dict` #76

Open Moelf opened 3 years ago

Moelf commented 3 years ago
julia> using TypedTables

julia> a = Dict("a" => [1,2,3], "b"=>[1.0, 2.0, 3.0])
Dict{String, Vector{T} where T} with 2 entries:
  "b" => [1.0, 2.0, 3.0]
  "a" => [1, 2, 3]

julia> Table(a)
ERROR: Cannot construct table from Dict{String, Vector{T} where T}
Stacktrace:

Dataframes support this, I wonder how hard it would be to support it directly here.

andyferris commented 3 years ago

Thanks for the suggestion.

I wonder if we can make this a Tables.jl table?

Moelf commented 3 years ago

the use case is that I want to loop through each row of each dataframe after a groupby operation, which looks to me requires flexibility from DataFrames and followed by a TypedTables "wrapper" to help with the performance within the for row in eachrow() loop because compiler knows what row.col_name is.