title: iPython: how do I count the number of times a string appears in a cell?
body: <p>I have a data frame with the columns <code>Movie Title</code> and <code>Cast</code> that looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/05Ziz.png" alt="picture of csv"></p>
  
  <p>Column 1 has the name of the movie, whilst Column 2 lists the full cast of the film. The cast has been taken from the site TMDB. </p>
  
  <p>Column 2 has the pattern: <code>'cast_id': {cast_id_number}</code>, <code>'character': {character_name}</code>, <code>'credit_id': {credit_number}</code>, <code>'gender': {gender_identifier}</code>, etc. </p>
  
  <p>I am writing a project for school looking at the gender split in different films. I therefore want to create a column that counts the number of male/female actors in a specific film. e.g: </p>
  
  <pre><code>Movie Title | Cast | No. of Males | No. of Females
  Toy Story   | .... | 3            | 7
  </code></pre>
  
  <p>However, I'm not sure how to go about doing this. I've tried using <code>str.count</code> but it keeps returning all values as 0, even if I can see a cell contains <code>'gender': 2</code> or <code>'gender': 1</code>. </p>
  
  <p>I'm assuming it may need an if loop counter that reads the string in each row and adds 1 every time it encounters <code>'gender': 2</code> but have no idea how to implement this. </p>