Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #find the highest selling brand
- autos['brand'].value_counts(normalize=True)[:10]
- # find the price ranges within brands
- brands_mean_price = {}
- for brand in autos['brand'].unique():
- if brand not in brands_mean_price:
- brands_mean_price[brand] = round(autos['price_dollar'][autos['brand']==brand].mean(), 0)
- # Sort dictionary by values in reverse order
- sorted(((value, key) for (key,value) in brands_mean_price.items()), reverse=True)[:20]
Add Comment
Please, Sign In to add comment