This is the holiday list
- 1-Jan-21 New Year
- 16-Jan-21 Shankaranthi
- 26-Jan-21 Republic Day
- 18-Feb-21 ID Day
- 1-May-21 May Day
- 15-Aug-21 Independence Day
- 1-Nov-21 Karanataka Day
I have created a .CSV file and imported my holiday list as dataframe.
H = pd.read_csv('HolidayC.csv') H1 = H.drop(['Holi_id'], axis = 1) H1
Output of Holidayc.csv I then later imported my shift timings
sft = pd.read_csv('SHIFT.csv') sft
Output of shift timings I have created the the following code to generate Dates from 1/Jan/2021 to 31/dec/2021:
import pandas as pd import numpy as np import datetime as dt from datetime import datetime import random start_date = dt.date(2021,1,1) end_date = dt.date(2021,12,31) rstr=pd.DataFrame(columns=['Date','Reason','Day','Name','shift_desc','Start Time','End Time',]) required_date = [] weekday = [] daterange = pd.date_range(start_date, end_date) for single_date in daterange: required_date.append(single_date.strftime("%Y-%m-%d")) weekday.append(single_date.strftime("%A")) rstr['Date'] = required_date rstr['Day'] = weekday rstr.head()
I want to Know how I can replace holiday dates with reason in my rstr table. Kindly help.
Anonymous Asked question May 14, 2021
Recent Comments