5
$\begingroup$

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

Question

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.

$\endgroup$

1 Answer 1

9
$\begingroup$

Take the KeyUnion of your Dataset

enter image description here

$\endgroup$

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.