Skip to content

transform(df, :symbolname => AsTable) will not work for JSON data #3490

@stensmo

Description

@stensmo

While working with JSON data (or similar) in Julia it is common to have Dicts which you want to flatten/unnest.

transform(df, :b => AsTable) could be a great solution, but in JSON it is common for keys to be missing, and transform(df, :b => AsTable) will not work for this case.

Example:
a1=Dict("a"=>1, "b"=>Dict("c"=>1, "d"=>2))
a2=Dict("a"=>1, "b"=>Dict("c"=>1))
a=[a1;a2]
df=DataFrame(a)
bug=transform(df, :b => AsTable)

ERROR: ArgumentError: keys of the returned elements must be identical

Expected result: Missing value in row 2 for column d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions