Suppose we have a Dataframe with many columns Name,Sex, Age, Education, Race
. I want to create a DF only with the following columns Age,Sex,Educaion
.
I know that I can do it with the following method.
df2 = pd.DataFrame(df[['Age','Sex','Education']]
Is there a way to do something like this. i.e Select all columns excepth x, y, z.
df2 = pd.DataFrame(df(select all columns except the following columns = 'Race', 'Name'))