Combine Duplicate Rows and Sum the Values pandas code example
Example: pandas add count of repeated elements from column
dataframe.pivot_table(index=['column_name'], aggfunc='size')
dataframe.pivot_table(index=['column_1', 'column_2',...], aggfunc='size')
counts = dataframe.pivot_table(index=['column_name'], aggfunc='size')
counts = pd.DataFrame(counts)
counts.index.name = 'column_name'
counts.reset_index(inplace=True)
counts.columns = ['column_name', 'counts']
dataframe = dataframe.merge(counts)