Hello,
I am doing an analysis of how revenue changed over time (I grouped months and years and now I would like to visualise how the revenue changed over time. Barh plot works fine, but I would like to use multiple line chart for this (comparing how revenue changed over months in 2017, 2018 and 2019).
My code:
sales = task[[‘saleDate’,‘purchasePrice’]]
grouped = sales.groupby(‘saleDate’)[‘purchasePrice’]
task_stats = grouped.agg(np.sum)
pv_task_stats = sales.pivot_table([‘purchasePrice’], ‘saleDate’, aggfunc=np.sum)
pv_task_stats
*
output
|purchasePrice|
|saleDate||
|2017-01|12.00|
|2017-02|494.50|
|2017-03|392.10|
(…)
|2019-11|772.80|
|2019-12|488.40|
Do I have to save this pivot table to dataframe or do you have any other idea on how to do this?
Thank you in advace.