首页 > 解决方案 > 'DataFrame' 对象没有属性 'encode'

问题描述

# Open/create a file to append data to
csvFileuserid = open('useidmsg.csv', 'a')

#Use csv writer
csvWriter = csv.writer(csvFileuserid)
for i in uniqueid:
    #print(i)
    #print(type(i))
    try:
        a10=gp1.get_group(i)
        #print(a10)
        print(a10.shape)
    except:
        print(0)


     # Write a row to the CSV file. I use encode UTF-8
    csvWriter.writerow([a10.encode('utf-8')])
    print (tweet.created_at, tweet.text)
csvFileuserid.close()

代码出现以下错误:

'DataFrame' object has no attribute 'encode'

标签: python

解决方案


推荐阅读