I have the following dataframes in python that are part of a list
dataframe_list= []## CREATE AN EMPTY LIST
import pandas as pd
A=pd.DataFrame()
A["name"]=["A", "A", "A"]
A["att"]=["New World", "Hello", "Big Day now"]
B=pd.DataFrame()
B["name"]=["A2", "A2", "A2"]
B["Col"]=["L", "B", "B"]
B["CC"]=["old", "Hello", "Big Day now"]
C=pd.DataFrame()
C["name"]=["Brave old World", "A", "A"]
The above dataframes are of different sizes. these are stored as a list as follows
dataframe_list.append(A)
dataframe_list.append(B)
dataframe_list.append(C)
I am trying to extract two dataframes that contain the word world(irrespective of case). I have tried the following code
list1=["World"]
result=[x for x in dataframe_list if any(x.isin(list1) ) ]
This however is yielding all the dataframes. The expected output is dataframes A, C. Am not sure where I am making a mistake here