Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stensmo opened this issue Feb 18, 2025 · 0 comments
Open

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

stensmo opened this issue Feb 18, 2025 · 0 comments

Comments

@stensmo
Copy link

stensmo commented Feb 18, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant