I have a list of dataframes, called list_models
.
list_models=[df_gl,df_reg, df_in]
Each df consists of the same columns: Title, URL, Status
I am looking for a loop which looks for a string in Status
and updates list_models
.
list_models=[df[df['Status'].str.contains('In-depth', na=False)] |
[df['Status'].str.contains('Approve', na=False)]
for df in list_models]
This code won't update the dfs in list_models
and I don't understand why.
Can anyone explain it to me?
Apparently someone already posted a similar question. However the answer is not really comprehensive, at least for me. Apply a for loop to multiple DataFrames in Pandas