I want to be able to drop all columns that only have values from the list that I pass in.
list_of_drops = ['A','B']
d ={'C1':['A','A','A','B','B','B'],
'C2':['A','C','A','A','A','A'],
'C3':['A','B','B','A','B','B'],
'C4':['A','A','A','A','A','A'],
'C5':['A','A','B','AC','A','B'],
'C6':['A','A','AD','A','B','A']}
df = pd.DataFrame (d, columns = ['C1','C2','C3','C4','C5','C6'])
In this example, I want to create a dataframe that only has C1, C3, and C4.
To get rid of columns with just one value:
To get rid of columns with only values from a list: