I have a dataframe that looks like this
Year Season 2000 Winter 2002 Winter 2002 Summer 2004 Summer 2006 Winter and I want to be able to remove all the rows with Winter so it look like this
Year Season 2002 Summer 2004 Summer I have a dataframe that looks like this
Year Season 2000 Winter 2002 Winter 2002 Summer 2004 Summer 2006 Winter and I want to be able to remove all the rows with Winter so it look like this
Year Season 2002 Summer 2004 Summer Like this:
df = df[df['Season']!='Winter'] Explanation: df['Season']!='Winter' returns a boolean mask that you can use to index the original dataframe, thereby dropping all rows where season is winter.
See here: How to select rows from a DataFrame based on column values?