In the mathematica documentation it says that the syntax required to make "a table with named columns" is the following:

enter image description here

So consider some data arranged in this syntax:

dataset = Dataset[{
   <|"a" -> 1, "b" -> "x"|>,
   <|"a" -> 2, "c" -> "y"|>}

I want the "table with named columns" format above, but instead I keep getting the "table with named rows" format instead:

enter image description here


How do I force mathematica to use the "table with named columns" format?

so that my output looks like so:

![enter image description here

Please note that my actual table is more complicated and quite large. This is a minimalist example.


1 Answer 1


Take the KeyUnion of your Dataset

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.