how to count data point for each column in pandas code example
Example: python count variable and put the count in a column of data frame
df['freq'] = df.groupby('myvar')['myvar'].transform('count')
df['freq'] = df.groupby('myvar')['myvar'].transform('count')