So I have a dataframe where the state is the US state codes and the year columns have values for that particular state, the data frame has values for all the states, is there a way I can pivot so that there is an ""Year"" column for all the years and values are in just one column.
My current dataframe :
STATE YEAR2021 YEAR2022 YEAR2023 ....
XX XX XX XX
Desired DataFrame:
STATE YEAR VALUE
XX 2021 XX
XX 2022 XX
XX 2023 XX
How do I achieve this in python?