I am extracting features to look for the weekdays. What I have so far is this:
days = {0:'Mon', 1: 'Tues', 2:'Wed', 3:'Thurs', 4:'Fri', 5:'Sat', 6:'Sun'}
data['day_of_week'] = data['day_of_week'].apply(lambda x: days[x])
data['if_Weekday'] = np.where( (data['day_of_week'] == 'Mon') | (data['day_of_week'] == 'Tues') | (data['day_of_week'] == 'Wed') | (data['day_of_week'] == 'Thurs') | (data['day_of_week'] == 'Friday'), '1', '0')
This code will assign Mon-Fri as a 1
and Sat-Sun as a 0
. However, I would like to assign different values for the weekdays. For instance, Mon = 1, Tues = 2, Wed = 3, Thurs = 4, Fri = 5 and Sat and Sun should both equal 0.
Any help would be much appreciated.