0

I am trying to create a list of dataframes and concatenate them as follows:

columns=df.columns.to_list()
 variables = locals()
    for i in np.arange(9):
         variables["df_{0}".format(i)] = ([variables[df.loc[df[columns[i]].str.contains('word')]]])
         dftot=pd.concat=variables["df_{0}".format(i)]

And I am getting this error: TypeError: 'DataFrame' objects are mutable, thus they cannot be hashed

Thank you

  • What are you really trying to do? This seems to be overly complicated for searching columns containing words. – Jonathan Leon Jun 03 '21 at 14:15
  • Thanks for answering. I am trying to search for a word or list of words in every column and loc the row containing the word. The word can be part of a sentence. – Juan Alberto Jun 03 '21 at 16:27
  • see if this helps: https://stackoverflow.com/questions/26640129/search-for-string-in-all-pandas-dataframe-columns-and-filter otherwise post some of your dataframe and a list of words to search. You should consider changing your title and framing of your question – Jonathan Leon Jun 03 '21 at 16:48

0 Answers0