I have a dataframe with lots of columns in it. Now I want to select only certain columns. I saved all the column names that I want to select in the Python list, and now I want to filter my framework according to this list.
I tried to do:
df_new = df[[list]]
where the list includes all the column names that I want to select.
However, I get an error message:
TypeError: unhashable type: 'list'
Any help on this?
python pandas dataframe
Aarondt
source share