-1

I am using an IMDB dataframe here:

My goal is to get the top 10 drama movies. This is in the genre column, along with other genres like 'action', 'adventure', 'comedy' etc. How would I go about grabbing just the movies with the 'drama' values?

Alexander
  • 127
  • 1
  • 10
  • Pandas has a whole set of [the docs](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html) dedicated to indexing, selecting, and filtering. What have you tried so far based on your own research? – G. Anderson Feb 26 '20 at 22:13
  • 1
    @G.Anderson The question you referred to me is exactly what I need, I was asking Google the wrong things-- ie 'sorting', which I couldn't find any answers with. – Alexander Feb 26 '20 at 22:16
  • `df = pd.read_csv('https://media.githubusercontent.com/media/bnmnetp/httlads/master/Data/movies_metadata.csv'); drama = df[df['genres'].str.contains("'name': 'Drama'")]` – Alexander Feb 26 '20 at 22:20

1 Answers1

1
drama_data = data[data.genres == "drama"]
UncleBob
  • 41
  • 10