4
$\begingroup$

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["http://i.stack.imgur.com/97yPG.png"],"Byte"]]]]

and in case it isn't obvious

specs = {"D86Diameter", "NullSplitRadius", "AmplitudeRippleSD", 
   "AmplitudeRipplePP", "PhaseSlope", "PhaseErrorSigma", 
   "PhaseErrorPP"};
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Chris Nadovich Jun 29 '17 at 19:43
  • $\begingroup$ 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. $\endgroup$ – rhermans Jun 29 '17 at 19:57
  • 1
    $\begingroup$ 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). $\endgroup$ – WReach Jul 1 '17 at 4:54
  • $\begingroup$ The definition of specs is just the column names, but I added it above. Changing the query as you suggest @WReach made no difference. $\endgroup$ – Chris Nadovich Jul 1 '17 at 16:04
  • $\begingroup$ 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 :) $\endgroup$ – Chris Nadovich Jul 1 '17 at 16:09
0
$\begingroup$

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."

$\endgroup$

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