I am trying to display the number of movies and the number of tv shows produced in 5 select countries (of my dataframe).
I have managed with just one (in this case the US)
netflix_df.loc[netflix_df['country'] == 'United States']['type'].value_counts().head(5)
returns this:
Movie 2058 TV Show 760
However, I don't know how I can display the same with 4 other select countries without writing 4 other different lines. Is there another way?
CodePudding user response:
Do you mean select countries that you are giving? Then something like this would work:
netflix_df.loc[netflix_df['country'].isin(['United States', 'Germany', 'Argentina', 'Belgium'])]['type'].value_counts().head(5)