Skip to content
Advertisement

Calculating YoY growth for daily volumes in python pandas

sample Excel data

I have 5 years of daily volume data. I want to create a new column in pandas dataframe where it produces the values of YoY Growth for that particular day. For e.g. compares 2018-01-01 with 2017-01-01, and 2019-01-01 compares with 2018-01-01

I have 364 records for each year (except for the year 2020 there are 365 days)

How can I create the column YoY_Growth as below in pandas dataframe.

Advertisement

Answer

JavaScript

Result (Volume was randomly generated):

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement