I have a huge dataframe where I have to identify and mark rows as "Actuals" & "Forecast" depending upon the current date.
Sample df:
Date Description
2021-01-01 A
2021-01-02 B
2021-01-03 B
2021-01-04 B
2021-01-05 A
2021-01-06 A
2021-01-07 A
2021-01-08 B
2021-01-09 B
2021-01-10 A
I am able to filter the dataframe based on the below code:
today = dt.date.today().strftime("%Y-%m-%d")
df[(df['Date'] < today)]
But what I actually want is to keep all rows and add a column based on the current date and segregate the rows as actuals (if they are before or on the current date) and forecast (if they are after the current date)
For example, if the current date is 5th Jan 2021 then:
Expected df:
Date Description Data_Residue
2021-01-01 A Actuals
2021-01-02 B Actuals
2021-01-03 B Actuals
2021-01-04 B Actuals
2021-01-05 A Actuals
2021-01-06 A Forecast
2021-01-07 A Forecast
2021-01-08 B Forecast
2021-01-09 B Forecast
2021-01-10 A Forecast
Any suggestions are appreciated. I have a huge dataframe so I was hoping not to use IF STATEMENT.