4

I have a list of associations data set. If I do a simple Mean[] with GroupBy on two columns, I get a nice tidy table display.

dataset[GroupBy["Charge"],  GroupBy["Apodization"], Mean, specs]

enter image description here

But if I replace Mean[] with my own function myMean[], I get a totally different, and quite redundant, table display. What's going on!?

myMean[list_] := Mean[list]

dataset[GroupBy["Charge"], GroupBy["Apodization"], myMean, specs]

enter image description here

The actual Dataset is at www.dropbox.com/s/zld9dv34iuomnoz/gdd.m?dl=0

Get["https://www.dropbox.com/s/zld9dv34iuomnoz/gdd.m?dl=1"]

or

Get["https://pastebin.com/raw/SfJ2n5D6"]

or you can get it by

dataset=Uncompress[FromCharacterCode[
  Flatten[ImageData[Import["https://i.stack.imgur.com/97yPG.png"],"Byte"]]]]

and in case it isn't obvious

specs = {"D86Diameter", "NullSplitRadius", "AmplitudeRippleSD", 
   "AmplitudeRipplePP", "PhaseSlope", "PhaseErrorSigma", 
   "PhaseErrorPP"};
Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
Chris Nadovich
  • 509
  • 2
  • 11
  • I've reproduced this oddity with a random list-of-associations dataset, so I'm pretty sure it's not related to my particular dataset, specifically. It doesn't seem to happen with small names, but as the names get longer suddenly the behavior appears. Weird. – Chris Nadovich Jun 29 '17 at 19:43
  • Welcome! To make the most of Mma.SE start by taking the [tour] now. It will help us to help you if you write an excellent question. Edit if improvable, show due diligence. Thanks for including a minimal working example of code and data. In the future try to use the formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. – rhermans Jun 29 '17 at 19:57
  • 1
    Please provide the definition of specs since it might be relevant for the answer. In the meantime, try changing the first query operator to GroupBy["Charge"] /* Dataset as a work-around. Erratic dataset formatting is also discussed in (146177) and (143413). – WReach Jul 01 '17 at 04:54
  • The definition of specs is just the column names, but I added it above. Changing the query as you suggest @WReach made no difference. – Chris Nadovich Jul 01 '17 at 16:04
  • And now, with slightly different numbers the formatting has flipped around so I can't get the format with column names (specs) on top of the columns at all. I understand that some people think this Dataset visualization is just a "convenience" thing, like the visualization of Interpolation, but if that's the case, why the heck is it so darn pretty!? It's such a tease -- beautifully formatted tables of your data .... juuuuust out of reach :) – Chris Nadovich Jul 01 '17 at 16:09
  • I think 146177 says it best with the phrase: "These two constructs have the same Normal, but they are displayed differently." And this issue appears to be discussed in length here – Chris Nadovich Jul 01 '17 at 16:14
  • @WReach, I can't replicate your GroupBy["Charge"] /* Dataset workaround in 11.1 - format looks the same as OP's. – alancalvitti Aug 31 '17 at 16:15

1 Answers1

0

I'm not sure there's a good answer other than 143413, which states "Whether or not this is an outright bug is a matter of perspective."

Chris Nadovich
  • 509
  • 2
  • 11