I have the following type of dataframe:
import pandas as pd
data = {
'Uni' : ['FUNDP','FUNDP','FUNDP','Ulg','Ulg','ULB'],
'data': [1.1,1.1,1.1,2.0,2.0,1.]
}
df=pd.DataFrame(data)
I would like to count the number of times I have the same values in column Uni and pass the result into a new column called Count. Here is an example of the outcome I'm looking for:
Uni data Count
FUNDP 1.1 3
FUNDP 1.1 3
FUNDP 1.1 3
Ulg 2.0 2
Ulg 2.0 2
ULB 3.0 1