...

/

Challenge Solution Review

Challenge Solution Review

In this lesson, we explain the solution to the last challenge lesson.

Solution review - Drop duplicated rows on SN column and return the total price of male group

Press + to interact
import pandas as pd
df = pd.read_csv("raw_data.csv",
sep=",",
header=0)
df.drop_duplicates(subset=["SN"], keep="last", inplace=True)
male_total = df.groupby(["Gender"]).get_group("Male").sum()["Price"]
print(male_total)

From line 3 to ...