title: How to count number of rows with a specific string value in a column using pandas?
body: <p>I have a pandas column with <code>dtype 'object'</code> that contains numeric values and the value <code>'?'</code>.</p>
  <p>How should I proceed to count the number of rows that have the value <code>'?'</code> ?</p>
  <p>I'm trying to run:</p>
  <pre><code>question_mark_count = df['column'].str.contains('\?').sum()
  </code></pre>
  <p>in a column that has numeric value and some question marks '?', but I'm getting the error:</p>
  <pre><code>AttributeError: Can only use .str accessor with string values!
  </code></pre>
  <p>When I run <code>df.dtypes</code>, I can see that the column is <code>'object' type</code>.</p>
  <p>I've also tried to convert the column to string:</p>
  <pre><code>df[&quot;column&quot;] = df[&quot;column&quot;].astype(&quot;string&quot;)
  </code></pre>
  <p>But I'm still getting the same error.</p>