强制转换为Unicode:需要字符串或缓冲区,找到int

时间:2019-01-31 14:58:46

标签: python data-analysis

我已经将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

0 个答案:

没有答案