【发布时间】:2021-11-08 20:49:06
【问题描述】:
我收到一个错误 - TypeError: ufunc 'bitwise_and' not supported for the input types, and the input can not be safe to force to any supported types based on cast rule ''safe when running a simple loop . 如何纠正?
for i in range(0,df.shape[0]+1):
if(df.iloc[i,8] >= 90):
df.iloc[i,9]="Ex"
elif (df.iloc[i,8] >= 80 & df.iloc[i,8] <90):
df.iloc[i,9]="A"
elif(df.iloc[i,8] >= 70 & df.iloc[i,8] <80):
df.iloc[i,9]="B"
elif(df.iloc[i,8] >= 60 & df.iloc[i,8] <70):
df.iloc[i,9]="C"
elif(df.iloc[i,8] >= 50 & df.iloc[i,8] <60):
df.iloc[i,9]="D"
else:
df.iloc[i,9]="E"
【问题讨论】:
标签: python pandas dataframe for-loop if-statement