count all columns int 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')