I have a csv file with data that I grouped the information on months and then used cumsum to calculate the running total for the month into a dataframe.
Using this code:
df = df.sort_index(sort_remaining=True).sort_values('months')
df['value'] = df.groupby('months')['value'].cumsum()
OUTPUT example in EXCEL, but my DF will look the same with 1000's of rows:
I would now like to plot a chart that groups the month and plot each value so basically I will have 12 plotted lines showing how the value moved either higher or lower over time.
The output plot will look like the following chart showing cumsum of each month:
I believe need
pivot
withrename
for months names instead numeric and for new index values usecumcount
:Detail:
EDIT:
For define only some months for plot use
subset
:Or filter months in input
DataFrame
byboolean indexing
andisin
: