I have the following df:
tz.head() state 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 0 AL 5.7 4.5 4.0 4.0 5.7 11.0 10.5 9.6 8.0 7.2 6.8 6.1 1 AK 7.5 6.9 6.6 6.3 6.7 7.7 7.9 7.6 7.1 6.9 6.9 6.5 2 AZ 5.0 4.7 4.2 3.9 6.2 9.9 10.4 9.5 8.3 7.7 6.8 6.1 3 AR 5.7 5.2 5.2 5.3 5.5 7.8 8.2 8.3 7.6 7.3 6.1 5.2 4 CA 6.2 5.4 4.9 5.4 7.3 11.2 12.2 11.7 10.4 8.9 7.5 6.2
I would like to change it so that looks like this:
year state unemployment 2004 AL 5.7 2005 AL 4.5 2006 AL 4.0 2007 AL 4.0 2008 AL 5.7 2009 AL 11.0 2010 AL 10.5 2011 AL 9.6 2012 AL 8.0 2013 AL 7.2 2014 AL 6.8 2015 AL 6.1 2004 AK 7.5 2005 AK 6.9 2006 AK 6.6 2007 AK 6.3 2008 AK 6.7 2009 AK 7.7 2010 AK 7.9 2011 AK 7.6 2012 AK 7.1 2013 AK 6.9 2014 AK 6.9 2015 AK 6.5
The reason is that I have a df that is similarly shaped and I need to merge the two dfs. I have recently had similar df shaping issues that I have been unable to find simple quick solutions to with python. Does anyone know how to solve this kind of problem?