数据框中的case语句,我在这里做错了什么?
df1['Response'] = [4 if x =='Closed with monetary relief'
3 if x =='Closed with non-monetary relief'
2 if x =='Closed with explanation'
1 if x =='Closed'
0 if x =='Untimely response' for x in df1['Response']]
我看到的错误:
3 if x =='以非货币救济关闭' ^ SyntaxError: invalid syntax