Here is my dataframe:
jan f m a m j \
2000 -7.894737 22.387006 22.077922 14.5455 15.8038 -3.33333
2001 -3.578947 11.958763 28.741093 5.05415 74.7151 11.2426
2002 -24.439661 -2.570483 1.810242 8.56044 84.5474 -26.9753
2003 14.410453 -10.106570 8.179654 -11.6469 -15.0022 -13.9757
2004 -3.978623 -13.280310 2.558639 -1.13076 12.7156 -4.47235
2005 2.018146 1.385053 9.461930 14.1947 -10.4865 -11.1553
2006 -6.528617 -5.506220 -2.054323 1.39073 7.74041 -0.328937
2007 -1.634891 8.923088 4.951521 -1.33334 3.82215 7.69231
2008 20.539609 0.132377 -3.117323 6.53806 9.99998 16.1356
2009 -3.979917 -9.342541 -23.233634 -26.5963 -27.0396 -4.39528
2010 6.141145 5.304527 -4.722650 4.32727 -4.55749 -3.98345
2011 -1286.639676 16.295265 -13.697203 89.2141 12.4599 -2.56771
2012 1.939279 -6.047198 -273.852729 -2.06906 9.35551 -327.816
2013 5.361207 -0.341469 93.825888 -4.90762 61.0443 3.89917
2014 7.900937 65.372284 65.955447 -8.5217 8.12922 6.99473
2015 -116.635830 -1.094263 96.942247 -6308.42 -1.05717 1.70411
2016 67.714100 -8.219712 2806.000000 nr nr nr
The index values should come on x axis and the column names need to be displayed on y axis. How can I achieve that?
That is straightforward using
seaborn
; I demonstrate how to do it using random data, so all you have to do is to replacedata
in the example below by your actual dataframe.My dataframe looks like this:
The output then looks as follows (please note that the index is at the x-axis and the column names at the y-axis as requested):
Here is the entire code with some inline comments: