I have a little problem with my program.
I have a dataframe that looks like this:
Person FavMovie
1 Ma Se Fr
2 Ma
3 Se Ma
4 Fr Ma
5 Se
I want to calculate the total frequency for Ma, Se and Fr and graph a barplot. However, I'm not sure about how to do that. I thought about creating a list,and then count in a loop the number of times I find a specific movie; I started writing the code this way:
favmovies_list = dataset['FavMovies'].tolist()
for element in favmovies_list:
singlemovie = element.strip()
print(singlemovie)
But it's clearly not working since I'm only separating the rows and not the single movies. Maybe there is another, more straightforward way, but I am a real beginner and I am not sure. Thank you very much in advance.
question from:https://stackoverflow.com/questions/65836797/how-to-plot-the-frequency-of-the-single-elements-of-my-column