Screen Link:
https://app.dataquest.io/m/294/guided-project%3A-exploring-ebay-car-sales-data/7/exploring-price-by-brand
My Code:
brands = autos["brand"].value_counts().index
agg_counts = {}
for b in brands:
selected_rows = autos[autos["brand"] == b]
b_mean = selected_rows["price"].mean()
agg_counts[b] = b_mean
What I expected to happen:
The average price does not match with the average prices from the next lesson. I am wondering where I went wrong with my code above.
Here are the average prices from the next page:
audi 9336
bmw 8332
ford 3749
mercedes_benz 8628
opel 2975
volkswagen 5402
What actually happened:
{'jaguar': 11525.554054054053, 'skoda': 6353.544871794872, 'subaru': 3940.470588235294, 'toyota': 5148.0032733224225, ....}
Here are my averages:
'audi': 9212.9306621881
'bmw': 8260.768253366205
'ford': 3716.6291802308374
'mercedes_benz': 8523.472030981067
'opel': 2942.40447732878
'volkswagen': 5329.65634