Code
Code
In[]:=
a={{"Grupo5",1,2,3},{"Grupo1",4,5,6},{"Grupo5",7,6,7},{"Grupo2",8,9,10},{"Grupo2",8,9,10}};
Yours
Yours
In[]:=
yours=SortBy[PivotTable[Sort[Tabular[a,{"grupo","num 1","num 2","num 3"}]],Length[\b#["num 1"]]&,"grupo","num 2",IncludeGroupAggregates->True],#[[1]]&]
Out[]=
Tabular
Mine
Mine
In[]:=
mine=PivotTable[Tabular[SortBy[a,First],{"grupo","num 1","num 2","num 3"}],Length[#["num 1"]]&,"grupo","num 2",IncludeGroupAggregates->True]
Out[]=
Tabular
“Exactly the same”
“Exactly the same”
In[]:=
yours==mine
Out[]=
False
Sorting
Sorting
In[]:=
Keys[yours]
Out[]=
{RowKey[{All}],RowKey[{Grupo1}],RowKey[{Grupo2}],RowKey[{Grupo5}]}
In[]:=
Keys[mine]
Out[]=
{RowKey[{Grupo1}],RowKey[{Grupo2}],RowKey[{Grupo5}],RowKey[{All}]}