>top=int(top)
well_blocks_in_Y=int(well_blocks_in_Y)
right=int(right)
left=int(left)
ty=0
ls=[]
for i in range (len(df_main)):
if (df_main.Y.loc[i] < (top-well_blocks_in_Y) and (left) < df_main.X.loc < (right-1)):
for j in range(well_blocks_in_Y):
ty = ty + df_main.Ranking.loc[(i+(j*(right-left)))]
ty = ty + df_main.Ranking.loc[(i+(j*(right-left))-1)]
ty = ty + df_main.Ranking.loc[(i-(j*(right-left))+1)]
ls.append(ty)
ty=0
else:
ls.append('')
df_rank_y=pd.DataFrame(data=ls,index=None)
错误是
unorderable types: int() < _LocIndexer().
我在将pandas df数据类型numpy.int64
与用户输入的int数据类型进行比较时得到了这个。
答案 0 :(得分:0)
df_main.X.loc [i]&lt; (右1)代替df_main.X.loc&lt; (右1) 在第8行
由Jean-FrançoisFabre提供的答案