我已经将n
的值设置为0
,以便借助iloc[]
可以比较和迭代某些列。
n = 0
for n in request_id:
if dframe1.iloc[: , n+1] != dframe1.iloc[: , n]:
if dframe1.iloc[: , n] == 0:
print 'logged'
else:
print 'solved'
elif dframe.iloc[: , n+1] == dframe1.iloc[: , n]:
if dframe.iloc[: , n] == 0:
print 'not logged'
else:
print 'Repeated'
运行程序时出现此错误。
TypeError Traceback (most recent call last)
<ipython-input-30-a5672dab4bb1> in <module>()
1 n = 0
2 for n in request_id:----> 3 if dframe1.iloc[: , n+1] != dframe1.iloc[: , n]:
4 if dframe1.iloc[: , n] == 0:
5 print 'logged'TypeError: coercing to Unicode: need string or buffer, int found