Filtering Brands

I’m working on the Exploring Ebay Car Sales Data, and I want to filter the data to the top brands. The solution calculates top brands as those with more than .05 of market share. I want to calculate top brands as those with more than 1000 sales.

The solution code to generate the list of top brands is:
brand_counts = autos[“brand”].value_counts(normalize=True)
common_brands = brand_counts[brand_counts > .05].index

I’ve been trying to create similar code, but failing. This is what I have:
brand_counts = [autos[“brand”].value_counts()]
selected_brands = brand_counts[brand_counts > 1000].index

Can you tell me where I’ve gone wrong?

Hi @everydaybest

What is the error message you are getting?
Do you think the error has to do anything with brand_counts = [autos[“brand”].value_counts()] made into a list because of the outer [ ] ?

I can’t believe that was it. Thanks!

It makes sense that I formatted it as a list, and it isn’t.

1 Like

Glad you found the solution!