Skip to content

transform(df, :x => AsTable)` should probably work #2779

@pdeffebach

Description

@pdeffebach

I think the following should maybe work

julia> vnt = [(a = 1, b = (c = 2, d = 3)), (a = 4, b = (c = 5, d = 6))];

julia> df = DataFrame(vnt)
2×2 DataFrame
 Row │ a      b              
     │ Int64  NamedTup…      
─────┼───────────────────────
   1 │     1  (c = 2, d = 3)
   2 │     4  (c = 5, d = 6)

julia> transform(df, :b => AsTable)
2×3 DataFrame
 Row │ a      b               b_AsTable                         
     │ Int64  NamedTup…       AsTable                           
─────┼──────────────────────────────────────────────────────────
   1 │     1  (c = 2, d = 3)  AsTable(NamedTuple{(:c, :d), Tup…
   2 │     4  (c = 5, d = 6)  AsTable(NamedTuple{(:c, :d), Tup…

I think maybe this and transform(df, :b => [:x, :y]) should work, given that transform(df, :b => :bb) works.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions