将附加数据框与字符串数据一起使用时出错

I'm running a loop in matching items using fuzzywuzzy and I'm trying to save the results into a dataframe using append but I'm getting the error AttributeError: 'property' object has no attribute 'append'

在过去的几天里,我一直坚持这一点。理想情况下,我想将5行匹配项添加到数据框的底部-列应包括Fuzzywuzzy匹配项和相应的分数。下面的代码段...

x = 0
matchDF = pd.DataFrame.empty
for index, value in theData.head(5).iteritems():
    lookup = theData.index[x]

    theMatch =  process.extract(lookup, theData.index)
    matchDF = matchDF.append(theMatch)    
    x += 1
评论
  • ueaque
    ueaque 回复
    matchDF = pd.DataFrame.empty
    

    返回没有附加方法的属性对象。 更改为

    matchDF = pd.DataFrame()
    

    这会工作