Skip to content

Initializing Dataframe from vector of named tuples: missing values #3370

@lukas-weber

Description

@lukas-weber

When I initialize my dataframe using

df = DataFrame([(a=1,b=2), (a=3,b=4), (a=1,)])

I would expect to get

a b
1 2
3 4
1 missing

Instead I get an error

ERROR: type NamedTuple has no field b
Stacktrace:
  [1] getproperty
    @ ./Base.jl:37 [inlined]
  [2] getcolumn
    @ ~/.julia/packages/Tables/AcRIE/src/Tables.jl:102 [inlined]

Is there a simple way to get the former behavior? Should it be what DataFrames does by default instead of throwing an error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions