Say I have a nested Association like this one:
assc = <|1-><|a1-><|opt->0.734149,fit->0.56074|>,a2-><|opt->-0.268146,fit->-0.536405|>,a3-><|opt->23.1298,fit->12.5986|>|>,2-><|a1-><|opt->9.53617*10^-8,fit->0.337033|>,a2-><|opt->-0.0000357894,fit->-0.250143|>,a3-><|opt->2.76778*10^-6,fit->-7.54487|>|>,3-><|a1-><|opt->0.80264,fit->0.526605|>,a2-><|opt->-0.0159458,fit->-0.646664|>,a3-><|opt->45.9309,fit->-12.3689|>|>,4-><|a1-><|opt->0.913804,fit->0.741119|>,a2-><|opt->-0.145981,fit->-0.808445|>,a3-><|opt->11.7184,fit->2.29814|>|>,5-><|a1-><|opt->0.702291,fit->0.528957|>,a2-><|opt->-0.0902689,fit->-0.25787|>,a3-><|opt->11.4746,fit->12.7903|>|>|>
whose Dataset
view looks like this:
I'd like to Transpose
the Dataset to rearrange its levels as the similar operation over its values:
Transpose[(assc //. assc : Association[v__] :> Values[assc]), {1, 3, 2}]
However, I find such Transpose
operation is not possible over an Association
:
Transpose[assc, {1, 3, 2}]
What is the proper way in Mathematica to do that?
Transpose /@ assc
instead. $\endgroup$Association
is actually atomic, which might cause this more difficult. $\endgroup$Dataset
supportsTranspose
, you might want to tryassc // Dataset // #[;; , Transpose] & // Normal
. $\endgroup$