1
I would like to know how to transpose the observations of a dataframe to turn it into variables.
The Subcategory column has to break down into several variables and its observations would be the values of the Value column.
Subcategory Month Year Value
Market Capitalisation Jan 2017 4263898536
Market Capitalisation Feb 2017 4419020321
Market Capitalisation Mar 2017 4414519507
Market Capitalisation Apr 2017 4357532117
Market Capitalisation May 2017 4319919895
Market Capitalisation Jun 2017 4516233772
Market Capitalisation Jul 2017 4681045125
Market Capitalisation Aug 2017 4903344904
Market Capitalisation Sep 2017 4990670387
Market Capitalisation Oct 2017 5055295743
Market Capitalisation Nov 2017 4984089607
Market Capitalisation Dec 2017 5024983764
Stock Market Index Jan 2017 1106898267
Stock Market Index Feb 2017 113341555
Stock Market Index Mar 2017 1143731232
Stock Market Index Apr 2017 1134052782
Stock Market Index May 2017 1092165111
Stock Market Index Jun 2017 1110235884
Stock Market Index Jul 2017 1137200988
Stock Market Index Aug 2017 1160249513
Stock Market Index Sep 2017 1186970461
Stock Market Index Oct 2017 1195333521
Example of how it would look, remembering that I have data from 2017 until 2021.
Market Capitalisation Month Year
4263898536 Jan 2017
4419020321 Feb 2017
4414519507 Mar 2017
4357532117 Apr 2017
4319919895 May 2017
4516233772 Jun 2017
4681045125 Jul 2017
4903344904 Aug 2017
See this topic for different options on how to do this: https://answall.com/questions/360773/o-que-s%C3%a3o-dados-no-formato-wide-long
– Carlos Eduardo Lagosta