i have two dataframes
I will use this dataframe to filter that dataframe by the column names.
How can i do that with pandas?
i have two dataframes
I will use this dataframe to filter that dataframe by the column names.
How can i do that with pandas?
If the data frame with the column names all exist(No non-existent value) then you can just turn the column names into a list and put it in like this
df = df[column_list]
Otherwise like this
df.loc[:, df.columns.isin(column_list)`