I have dataframe(df) as shown below:
from datetime import date
Today = str(date.today())
df['Today_Date'] = Today
Status_Date Today_Date Planned_Date
25-11-2020 27-11-2020 25-11-2020
28-11-2020 27-11-2020 29-11-2020
26-11-2020 27-11-2020 29-11-2020
27-11-2020 27-11-2020 27-11-2020
30-11-2020 27-11-2020 29-11-2020
23-11-2020 27-11-2020 24-11-2020
I need compare Status_date and Planned_Date with Today_date which ideally current date and create new column as shown below:
Expected Output
Status_Date Today_Date Planned_Date Status_Color
25-11-2020 27-11-2020 25-11-2020 Red
28-11-2020 27-11-2020 29-11-2020 Green
26-11-2020 27-11-2020 29-11-2020 Amber
27-11-2020 27-11-2020 27-11-2020 Amber
30-11-2020 27-11-2020 29-11-2020 Green
23-11-2020 27-11-2020 24-11-2020 Red
How can this be done in python?
Red, Green, Amber?Status DateandPlanned_Dateis less than` Today_Date` then Red .2.IfStatus DateandPlanned_Dateis greater than` Today_Date` then Green. 3.Else Amber