Message Boards Message Boards

0
|
6709 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Number of columns in Dataset[] - Is this a bug?

Hi everyone,

I'm not sure if this is a bug or if I'm missing something really obvious. But consider these examples:

Dataset works fine here:

Dataset[{Association[
   Rule @@@ Transpose[{CharacterRange["a", "p"], Range[16]}]]}]

The output looks as expected:

enter image description here

However, if I add another column, like this:

Dataset[{Association[
   Rule @@@ Transpose[{CharacterRange["a", "q"], Range[17]}]]}]

... the output looks like this:

enter image description here

I can't see this as expected behaviour, but as I said, maybe I'm missing something and this is a really clever feature... But it certainly looks like a bug! I should add that the example with 17 columns still seems to behave like a Dataset for subsequent operations, but the typesetting/formatting as a tabular structure would really be nice to have as well. Also, this behaviour is not related to the actual width of the output, Dataset works with 16 columns that are much wider than the ones in my example.

For reference, I'm using Mathematica 10.1 in Windows 7.

Thanks for any help you can provide,

Bianca

Edit: Oh, great, found another seemingly related issue: Part with Span also seems to disrupt the formatting:

enter image description here

POSTED BY: Bianca Eifert
4 Replies

You'll find an answer to your first question here (be sure to also check the comments):

POSTED BY: Szabolcs Horvát

enter image description here

POSTED BY: Simon Cadrin

enter image description here

POSTED BY: Simon Cadrin

Simon - thank you for your answer! I'm aware that I can cut the data into two datasets or find a different way to achieve similar typesetting. However, neither of these solutions really fixes the problem since they both have input and/or output that is something other than a single Dataset[] object. This means that I still have to treat Datasets of different sizes in different ways, which doesn't seem like reasonably intended behaviour.

Szabolcs - thank you for the link! Wow, that is... I mean... I've gained insight into the causes of the problem, but these causes and the suggested workarounds actually reinforce my impression that this must be a bug. The workaround suggested by Virgil is not an option for my current problem because if I lose the intuitive flexibility of Dataset by introducing new helper functions (and explaining them to users), other data structures suddenly become easier to use anyway, but I do suppose it's a good answer for other situations. So again, thank you for the link!

POSTED BY: Bianca Eifert
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