Guided Project: Exploring Ebay Car Sales Data (step 8 )


This is just to verify my solution for this step. I hope someone confirms.

brand_list = {}
brands = auto['brand'].unique()
for i in brands:
selected_brands = auto[auto["brand"] == i]
sorted_rows = selected_brands.sort_values("price", ascending=False)
top_brands = sorted_rows.iloc[0]
brand_mean_price = top_brands["price"].mean()
brand_list[i] = brand_mean_price 

bmp = pd.Series( brand_list)
print (bmp)

df = pd.DataFrame(bmp, columns=['price'])

Thank you and best regards

Hi @alroumi.abdulmajeed,
Do you have any problems with your solution?

No, I just want to make sure if my solution correct ?