0

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
1
  • This seems like a rather basic task, what part of it is not covered by the many existing resources on Pandas? Please see How to Ask, help center. Commented May 7, 2020 at 23:00

1 Answer 1

2

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?

Sign up to request clarification or add additional context in comments.

1 Comment

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.