Create a Column to Flag If a Date Falls on a Weekend

Python

 1|  orders['weekday'] = orders['Order_Date'].dt.weekday
 2|  orders['weekend'] = orders['weekday'].apply(lambda x: 1 if x == 5 or x == 6 else 0)
Did you find this snippet useful?

Sign up for free to to add this to your code library