import pandas as pd import numpy as np
raw_data = {'name': ['Willard Morris', 'Al Jennings', 'Omar Mullins', 'Spencer McDaniel'], 'age': [20, 19, 22, 21], 'favorite_color': ['blue', 'blue', 'yellow', "green"], 'grade': [88, 92, 95, 70]} df = pd.DataFrame(raw_data, index = ['Willard Morris', 'Al Jennings', 'Omar Mullins', 'Spencer McDaniel']) df
#here we should drop Al Jennings' record from the df, #since his favorite color, blue, is a duplicate with Willard Morris df = df.drop_duplicates(subset='favorite_color', keep="first") df