pandas just get total count for a column code example
Example 1: Returns the number of rows in this DataFrame
# Returns the number of rows in this DataFrame
df.count()
# 2
Example 2: python count variable and put the count in a column of data frame
df['freq'] = df.groupby('myvar')['myvar'].transform('count')