How to check if character exists in DataFrame cell
<p>After creating the three-rows DataFrame:</p>

<pre><code>import pandas as pd
df = pd.DataFrame({'a': ['1-2', '3-4', '5-6']})
</code></pre>

<p>I check if there is any cell equal to '3-4':</p>

<pre><code>df['a']=='3-4'
</code></pre>

<p><a href="https://i.stack.imgur.com/7UYJY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7UYJY.png" alt="enter image description here"></a></p>

<p>Since <code>df['a']=='3-4'</code> command results to <code>pandas.core.series.Series</code> object I can use it to create a "filtered" version of the original DataFrame like so:</p>

<pre><code>filtered = df[ df['a']=='3-4' ]
</code></pre>

<p><a href="https://i.stack.imgur.com/AGU3O.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AGU3O.png" alt="enter image description here"></a></p>

<p>In Python I can check for the occurrence of the string character in another string using:</p>

<pre><code>string_value = '3-4'
print('-' in string_value)
</code></pre>

<p>What would be a way to accomplish the same while working with DataFrames?</p>

<p>So, I could create the filtered version of the original DataFrame by
checking if '-' character in every row's cell, like:</p>

<pre><code>filtered = df['-' in df['a']]
</code></pre>

<p>But this syntax above is invalid and throws <code>KeyError: False</code> error message. </p>