I have a dataframe in this format:
{'April': {0: 3266.0, 3: 3044.0, 6: 3607.0},
'May': {0: 3767.0, 3: 3708.0, 6: 3709.0},
'June': {0: 4114.0, 3: 3539.0, 6: 4416.0},
'July': {0: 4544.0, 3: 5176.0, 6: 5298.0},
'August': {0: 4912.0, 3: 5424.0, 6: 5217.0},
'September': {0: 5358.0, 3: 5027.0, 6: 5262.0},
'October': {0: 5265.0, 3: 5163.0, 6: 5597.0},
'November': {0: 5167.0, 3: 5621.0, 6: 5457.0},
'December': {0: 3953.0, 3: 4074.0, 6: 4745.0},
'January': {0: 4235.0, 3: 5792.0, 6: 5067.0},
'February': {0: 3506.0, 3: 3861.0, 6: 3704.0},
'March': {0: 3840.0, 3: 3815.0, 6: 3679.0},
'year': {0: 2015, 3: 2016, 6: 2017}}
The task is to plot a time-series using the year column and respective values of the month from the dataframe. To do that I have tried converting the dataframe to long-form using pandas.wide_to_long
and pandas.pivot
but was unsuccessful any help will be much appreciated.
Expected output:
year, month, value
2015, January, 4235.0
2015, February, 3506.0
2015, March, 3840.0
... , ..., ...
2017, November, 5457.0
2017, December, 4745.0