I have a dataframe like as shown below

```
df = pd.DataFrame({'text': ["Hi how","I am fine","Ila say Hi"],
                   'tokens':[['Hi','how'],['I','am','fine'],['Ila','say','Hi']],
                    'labels':[['A','B'],['C','B','A'],['D','B','A']]})

```

I would like to do two things

a) count of each labels

b) count tokens under each label

I was trying something like below

```
flattened = [] 
op = itertools.zip_longest(df['tokens'],df['labels'])
for i in op:
    for la in df['labels']: 
        if la == 'A' : 
        flattened.append(val)

```

But this is incorrect and going no-where

I expect my output to have two dataframes/tables like as shown below

[![enter image description here](https://i.stack.imgur.com/BrdRX.png)](https://i.stack.imgur.com/BrdRX.png)