Guest User

Untitled

a guest
Jan 20th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #find the highest selling brand
  2. autos['brand'].value_counts(normalize=True)[:10]
  3.  
  4. # find the price ranges within brands
  5. brands_mean_price = {}
  6. for brand in autos['brand'].unique():
  7. if brand not in brands_mean_price:
  8. brands_mean_price[brand] = round(autos['price_dollar'][autos['brand']==brand].mean(), 0)
  9. # Sort dictionary by values in reverse order
  10. sorted(((value, key) for (key,value) in brands_mean_price.items()), reverse=True)[:20]
Add Comment
Please, Sign In to add comment