How to append multiple dataframes using a filter function

74 Views Asked by At

I am using the below code to iterate through many data frames based on a few keywords. There are 20 data frames and about 30 columns. I am not able to append each data frame to create a list of data frames. Any suggestions would be helpful.


out=[]
for df in dfs:
    out.append(df.filter(regex=r"key|words|find(?=[^\d]|$)"))

1

There are 1 best solutions below

0
AudioBubble On BEST ANSWER

This may work. Please let me know if there is a better way to make it work.

out=[]
for df in dfs:
    filtered=df.filter(regex=r"key|words|find(?=[^\d]|$)")
    out.append (filtered)