I wrote a function to determine the weekday. When I try to apply it to my data frame face the following error.
data['date'].head()
0 2016-01-01
1 2016-01-01
2 2016-01-01
3 2016-01-01
4 2016-01-01
def weekday_determination(col):
year, month, day = (int(x) for x in col.split('-'))
ans = datetime.date(year, month, day)
return ans.strftime('%A')
data['week_day'] = data['date'].apply(weekday_determination, axis=1)
I face the following error:
TypeError: weekday_determination() got an unexpected keyword argument 'axis'