I have two text datasets so I did the cleaning process and then I want to divide them into groups based on the name
column but after running the code I got the error unhashable type: 'list'
def cleanDataD(path='data1.csv'):
df = pd.read_csv(path, encoding = "ISO-8859-1")
df['name'] = df['name'].fillna(' ')
df['name'] = df['name'].apply(lambda x: remove_punct(x) )
df['name'] = df['name'].apply(lambda x: tokenizer.tokenize(x.lower()) )
df['name'] = df['name'].apply(lambda x: remove_stopWords(x) )
df['name_CV'] = df['name'].apply(lambda x: word_lemmatiser(x) )
df['name_CV'] = df['name_CV'].apply(lambda x: ['none'] if (len(x)== 0) else x)
df['city'] = df['city'].fillna(' ')
df['city'] = df['city'].apply(lambda x: remove_punct(x) )
df['city'] = df['city'].apply(lambda x: tokenizer.tokenize(x.lower()) )
df['city'] = df['city'].apply(lambda x: remove_stopWords(x) )
df['city_CV'] = df['city'].apply(lambda x: word_lemmatiser(x) )
df['city_CV'] = df['city_CV'].apply(lambda x: ['none'] if (len(x)== 0) else x)
df = df.fillna(0)
return df
def cleanDataH(path='data2.csv'):
df = pd.read_csv(path, encoding = "utf_8")
df['name'] = df['name'].fillna(' ')
df['name'] = df['name'].apply(lambda x: remove_punct(x) )
df['name'] = df['name'].apply(lambda x: tokenizer.tokenize(x.lower()) )
df['name'] = df['name'].apply(lambda x: remove_stopWords(x) )
df['name_CV'] = df['name'].apply(lambda x: word_lemmatiser(x) )
df['name_CV'] = df['name_CV'].apply(lambda x: ['none'] if (len(x)== 0) else x)
df['city'] = df['city'].fillna(' ')
df['city'] = df['city'].apply(lambda x: remove_punct(x) )
df['city'] = df['city'].apply(lambda x: tokenizer.tokenize(x.lower()) )
df['city'] = df['city'].apply(lambda x: remove_stopWords(x) )
df['city_CV'] = df['city'].apply(lambda x: word_lemmatiser(x) )
df['city_CV'] = df['city_CV'].apply(lambda x: ['none'] if (len(x)== 0) else x)
df = df.fillna(0)
return df
df_D = cleanDataD(path='data1.csv')
df_H = cleanDataH(path='data2.csv')
indexer =rl.Index()
indexer.block('name')
ff = indexer.index(df_D, df_H)
TypeError Traceback (most recent call last)
<ipython-input-35-c9ee905d6674> in <module>
----> 1 ff = indexer.index(df_H, df_D)
TypeError: unhashable type: 'list'
How to fix this error?