How can I set public holidays to weekend days?

Viewed 27

I want to set public holidays to be sundays in a dataframe. My original dataframe consits out of multiple years with every day of that years listed and has multiple colums with information about this day.

df has the colums: date (DD-MM-YYYY HH:MM), information, Weekday

I have another dataframe with a list of public holidays colums: date (DD-MM-YYYY)

How do I check if the dates from my original dataframe contains a public holiday and set it to a sunday (weekday = 6)?

df['Weekday'] = df.index.dayofweek

# read in csv file for holiday
public_holidays = pd.read_csv("public_holiday.csv", date_parser= parser_holiday, index_col=[0])

# set holiday as sunday
if public_holidays[0] in df[0]:
   df['Weekday'] = 6
0 Answers
Related