I work with Pandas data frame. I want to count data by one column. You can see example below:
data = {'name': ['Company1', 'Company2', 'Company1', 'Company2', 'Company1'], 'employee': [1, 1, 1, 1, 1], } df = pd.DataFrame(data, columns = ['name', 'employee']) df Now I want to count all employees from column employee into new column. I try to do this with this line of code
df['employees']=df.groupby(['name']).agg({'employee':np.count,}) But after execution this line of code I got this error:
module 'numpy' has no attribute 'count' So can anybody help me how to solve this problem ?
sizeorsumtransform.