0

I feel like this may be a really easy question but I can't figure it out I have a data frame that looks like this

one two three

1   2  3

2   3  3

3   4  4

The third column has duplicates if I want to keep the first row but drop the second row because there is a duplicate on row two how would I do this.

1

1 Answer 1

1

Pandas DataFrame objects have a method for this; assuming df is your dataframe, df.drop_duplicates(subset='name_of_third_column') returns the dataframe with any rows containing duplicate values in the third column removed.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.