Python list integrateUpper/Lowercase check?
<p>I currently use following code to select rows from a dataframe:</p>

<pre><code>list = ['3d block','3D Block','3D block','3d Block','cafe','Cafe']
data[data['description'].str.contains('|'.join(list))]
</code></pre>

<p>As you can see, I currently implement different queries for upper/lowercase, as I realized that '3d print' didn't really match all the items in question.</p>

<p>Can the code above be improved or shortened, so that the list includes all possible variations of upper/lowercase characters, both for one and two words?</p>

<p>You can do a <em>case InSeNsitIvE</em> selection  by passing the <code>case</code> parameter as <code>False</code>:</p>

<pre><code>lst = ['3D Block', 'cafe']
data[data['description'].str.contains('|'.join(lst), case=False)]
</code></pre>

<p>And remember to not use <code>list</code> as a name as this will shadow the builtin <code>list</code> function, and make it unusable later in your code.</p>

<hr>

<p>Reference:</p>

<p><a href="http://pandas.pydata.org/pandas-docs/version/0.18.1/generated/pandas.Series.str.contains.html" rel="nofollow">pandas.Series.str.contains</a></p>

python list uppercase lowercase