Message Boards Message Boards

0
|
1882 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

What optional argument to Dataset forces a desired header nesting?

Posted 1 year ago

Given

c1 = <|"Ca" -> "ca1", "Cb" -> "cb1", "Cc" -> "cc1"|>;
c2 = <|"Ca" -> "ca2", "Cb" -> "cb2", "Cc" -> "cc2"|>;
row1 = <|"A" -> "a1", "B" -> "b1", "C" -> c1, "D" -> "d1"|>;
row2 = <|"A" -> "a2", "B" -> "b2", "C" -> c2, "D" -> "d2"|>;
Dataset[{row1, row2}]

What is the optional argument to Dataset to force it to generate a nested inner-header as in the following image:

desired Dataset format

What follows is a longer format for the question above, and the unexpected finding that inserting a Quantity value in each row encourages Dataset to display the nested header correctly.


POSTED BY: A. Chase Turner
Posted 1 year ago

Why does inserting a Quantity change the Dataset format?

I don't think this is specific to Quantity. Just using raw numbers triggers the same behavior. I suspect that it's just using some basic heuristics, like display strings as rows and display numbers as columns.

What optional argument to Dataset avoids my having to insert Quantity values?

I don't know. Nothing obvious stands out to me. It might not be controllable. While Dataset does have some nice presentation features, I don't generally use Dataset as a presentation mechanism per se. I think it's primarily intended to support querying.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract