13.5 Interconversion of upper layer groups for rows and columns - row-to-column
Here below is a data table:
The first row is the column name, including the Country column and other information columns. Now we want to rearrange the data into the following form:
Script:
A | |
---|---|
1 | =E(‘Sheet2!A1:D4’).pivot@r(Country;Cate,Value;Meat,Vegetable,Oil) |
2 | =A1.group(Country).(~.run(Country=if(#==1,Country,""))).conj() |
3 | =transpose(A2.(#1|#2|#3)) |
A1: Perform the column-to-row conversion, and take the column names Meat, Vegetable and Oil as the values of Cate, and take the values in original Meat, Vegetable and Oil columns as the data in the Value column
A2: Group by Country, for each group, set the country values of non-first row as empty and then concatenate
A3: Merge the columns to become a sequence of sequences, transpose the sequence of sequences and return
esProc Desktop and Excel Processing
13.4 Interconversion of upper layer groups for rows and columns - column-to-row
13.6 Put data in a group horizontally into columns
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_Desktop/
SPL Learning Material 👉 https://c.scudata.com
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProcDesktop
Linkedin Group 👉 https://www.linkedin.com/groups/14419406/