我有一个数据框,我想创建一个函数,以便从其他2列创建一个列
def day(data=data):
if data['week_day'] == 'Saturday':
return 6
if data['week_day'] == 'Monday':
return 1
if data['week_day'] == 'Tuesday':
return 2
if data['week_day'] == 'Wednesday':
return 3
if data['week_day'] == 'Thursday':
return 4
if data['week_day'] == 'Friday':
return 5
if data['week_day'] == 'Sunday' & data['Month'] == 7:
return 7
if data['week_day'] == 'Sunday' & data['Month'] == 12:
return 8
else:
return 0
data['week_daye']= data.apply(day,axis=1)
但它得到了这个错误我该怎么解决呢