I have the following code which I would like to convert into a single line I guess using list comprehension? But I have been unsuccessful in converting it.
exp_days = ["16/04/2021","23/04/2021","27/04/2021"]
for i in range(len(df)):
if df["Date"][i] in exp_days:
list_of_days.append(1)
else:
list_of_days.append(0)
My dataframe:
Date
16/04/2021
19/04/2021
20/04/2021
21/04/2021
22/04/2021
23/04/2021
26/04/2021
27/04/2021
Expected output:
list_of_days = [1,0,0,0,0,1,0,1]