-1

i have a problem

my cod return erro:

AttributeError                            Traceback (most recent call last)
<ipython-input-19-b67acb628589> in <module>()
     20                           keep='match',
     21                           method='levenshtein',
---> 22                           threshold=0.85)
     23 
     24 

5 frames
/usr/local/lib/python3.7/dist-packages/csvmatch.py in <listcomp>(.0)
     66 
     67 def process_ignore_case(row):
---> 68     return [value.lower() for value in row]
     69 
     70 def process_ignore_nonalpha(row):

AttributeError: 'int' object has no attribute 'lower'

I'm using fuzzy_pandas for matching in between of the two table. table one:

dados_Meli = pd.DataFrame(table, columns=['Title'])

table two:

dados_Acom = pd.read_excel('dadosAcom2.xlsx')
df_Acom = dados_Acom[dados_Acom.columns.drop(list(dados_Acom.filter(regex='Unnamed:')))]

when running the code, I have the problem described above

full code:

import fuzzy_pandas as fpd

# lendo "dados Acom"
dados_Acom = pd.read_excel('dadosAcom2.xlsx')
df_Acom = dados_Acom[dados_Acom.columns.drop(list(dados_Acom.filter(regex='Unnamed:')))]
print(df_Acom['Title'])


# fuzzy merge ~ com dados do crawl do meli
Lista_Matching = fpd.fuzzy_merge(dados_Meli, df_Acom,
                      left_on = 'Title',
                      right_on = 'Title',
                      ignore_case=True,
                      keep='match',
                      method='levenshtein',
                      threshold=0.85)


# Export to Excel

rLista_Matching = pd.DataFrame(Lista_Matching)

rLista_Matching.to_excel(f'rLista_Matching_FP.xls', index = False)

sorry my bad english.

1 Answers1

0

As Green Cloak Guy pointed out, you should convert the columns you are using to match both DataFrame objects.

Here is a good answer for changing the type of a DataFrame series. You can apply it to the DataFrame objects you are merging, before calling fpd.fuzzy_merge.