# Plot frequency my_df['my_var'].value_counts().plot.bar() # Add column freq to the DF df['freq']=df.groupby(by='Name')['Name'].transform('count')
Here is what the above code is Doing:
1. We use the .groupby() method to group the data by the Name column.
2. We use the .transform() method to apply the .count() method to the Name column.
3. We add the resulting series to the original dataframe as a new column called freq.