I used pandas df.value_counts() to find the number of occurrences of particular brands. I want to merge those value counts with the respective brands in the initial dataframe.>
i think the best way is to use map
df['brand_count']= df.brand.map(df.brand.value_counts())
this is so much faster than groupby method for example (factor 500 on a 15000 row df) and take only one line