Question: I have a dictionary with some personality traits and related adjectives:

```
personality={'sincerity': [ "tru", "honest"],'excitement': ['excit', 'fizzy']} 

```

(note this is much longer)

As well I have a dictionary with lists of words extracted from tweets:

```
prova={"brand1": ["true", "truth", "thrutfull", "orange", "friend", "meaning"], "brand2": ["truth", "exiting", "excited", "lama", "lambo", "blade"]} 

```

I want to match one string in the personality dictionary with all the strings containing that character in the prova dictionary: the string "tru" in personality[sincerity] should match "true", "truth", "truthful" in prova[brand1] and "truth" in prova[brand2].

As i have many brands, I would like to do so through a for loop. any suggestion?

Answer: 
IIUC you need `transform`:

```
df["count"] = df.groupby("Name")["Tag"].transform("size")

print (df)

  Name  Tag Field  count
0    A    1     X      2
1    A    2     X      2
2    B    3     Y      2
3    B    4     Z      2
4    C    5     R      1

```
you can also try

```
df['Count'] = df['Name'].apply(lambda x: len(df.loc[df['Name'] == x, :]))

```