Pandas: find substring in a column
<p>I need to find in dataframe some strings</p>

<pre><code>url
003.ru/*/mobilnyj_telefon_bq_phoenix*
003.ru/*/mobilnyj_telefon_fly_*
003.ru/*mobile*
003.ru/telefony_i_smartfony/mobilnye_telefony_smartfony
003.ru/telefony_i_smartfony/mobilnye_telefony_smartfony/%brands%5D%5Bbr_23%
1click.ru/*iphone*
1click.ru/catalogue/chasy-motorola
</code></pre>

<p>problen in next: when I use </p>

<pre><code>df_update = df[df['url'].str.contains(substr.url)]
</code></pre>

<p>it return error, because some <code>url</code> contain <code>*</code>.
How can I fix that problem?</p>

<p>Try:</p>

<pre><code>df[df['url'].str.contains(substr.url, regex=False)]
</code></pre>

<p>You have to specify whether or not you want your pattern to be interpreted as a regular expression or a normal string. In this case, you want to set the <code>regex</code> argument to <code>False</code> because it is set to <code>True</code> by default. That way, the asterisks in your pattern won't be interpreted as regular expression.</p>

<p>I hope this helps.</p>

python regex pandas