Skip to main content
added 8 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
rsort = Apply[Association] @* Through @* 
  {ReverseSortBy[{Key @ "22"}] @* KeyDrop["Total"], KeyTake["Total"]};


Dataset @ rsort @ data 

enter image description here

Query[rsort] @ Dataset @ data

enter image description here

data2 = data;
data2["France", "18"] = 102.0;
Dataset @ rsort @ data2

enter image description here

rsort = Apply[Association] @* Through @* 
  {ReverseSortBy[{Key @ "22"}] @* KeyDrop["Total"], KeyTake["Total"]};


Dataset @ rsort @ data 

enter image description here

Query[rsort] @ Dataset @ data

enter image description here

rsort = Apply[Association] @* Through @* 
  {ReverseSortBy[{Key @ "22"}] @* KeyDrop["Total"], KeyTake["Total"]};


Dataset @ rsort @ data 

enter image description here

Query[rsort] @ Dataset @ data

enter image description here

data2 = data;
data2["France", "18"] = 102.0;
Dataset @ rsort @ data2

enter image description here

added 8 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
rsort = Apply[Association] @* Through @* 
  {ReverseSortBy["22"]ReverseSortBy[{Key @ "22"}] @* KeyDrop["Total"], KeyTake["Total"]};


Dataset @ rsort @ data 

enter image description here

Query[rsort] @ Dataset @ data

enter image description here

rsort = Apply[Association] @* Through @* 
  {ReverseSortBy["22"] @* KeyDrop["Total"], KeyTake["Total"]};


Dataset @ rsort @ data 

enter image description here

Query[rsort] @ Dataset @ data

enter image description here

rsort = Apply[Association] @* Through @* 
  {ReverseSortBy[{Key @ "22"}] @* KeyDrop["Total"], KeyTake["Total"]};


Dataset @ rsort @ data 

enter image description here

Query[rsort] @ Dataset @ data

enter image description here

added 39 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
rsort = Query[<|ReverseSortBy["22"]@KeyDrop["Total"]@#Apply[Association] @* Through @* 
  {ReverseSortBy["22"] @* KeyDrop["Total"], KeyTake["Total"]@#|>&];KeyTake["Total"]};


Dataset @ rsort @ data 

enter image description here

rsortQuery[rsort] @ Dataset @ data

enter image description here

rsort = Query[<|ReverseSortBy["22"]@KeyDrop["Total"]@#, KeyTake["Total"]@#|>&];

Dataset @ rsort @ data 

enter image description here

rsort @ Dataset @ data

enter image description here

rsort = Apply[Association] @* Through @* 
  {ReverseSortBy["22"] @* KeyDrop["Total"], KeyTake["Total"]};


Dataset @ rsort @ data 

enter image description here

Query[rsort] @ Dataset @ data

enter image description here

Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading