Ebay Car Sales: Most common brand / model combinations

Hello,

I tried to find the most common brand/model combinations in the “ebay kleinanzeigen” dataset. I created a dictionary with the combination as a key and the counts as the value:



for col, row in autos.iterrows():
    brand = row["brand"]
    model = row["model"]
    if (model, brand) not in brand_model_combi:
        brand_model_combi[(model, brand)] = 1
    else:
        brand_model_combi[(model, brand)] += 1

Now I’ve got a lot of combinations and their counts. I can’t sort them to find the most common combinations though.

Am I on the right way? Does anyone have a solution to get the 5 most common combinations? If so, please let me know.

Cheers,
Jonas

1 Like

Hi Jonas,

Sorry for the late response. Here is a way to find brand/model combinations:

autos['brand_model'] = autos['brand'] + '/' + autos['model']
autos['brand_model'].value_counts()[:5]
volkswagen/golf      3707
bmw/3er              2615
volkswagen/polo      1609
opel/corsa           1592
volkswagen/passat    1349
Name: brand_model, dtype: int64

Best,
Sahil

1 Like