' | ' operator between python set objects
<p>Recently while making changes to a python module someone else wrote which does some processing on Pandas dataframe I came across a line of code which looks like this :</p>

<p><code>
indices_invalid_entries = \
list(set(indices_invalid_entries) | set(list(df[pd.isnull(df[i])].index)))
</code></p>

<p>where indices_invalid_enteries is initially an empty list.
So basically what we are doing here is checking for Dataframe indexes in certain columns where there is <strong>NULL</strong> values.</p>

<p>Now I know what <strong>set, list, pd.isnull</strong> functions do.</p>

<p>But what can't seem to get is what purpose is the <em>BITWISE</em> <strong>OR</strong> operator <strong>|</strong> here. How will Bitwise OR(ing) of objects gonna store Indices of Invalid Enteries?</p>

<p>Can someone explain?
Thanks</p>

<p>You can always try it out:</p>

<pre><code>&gt;&gt;&gt; x = set([1,2,3])
&gt;&gt;&gt; y = set([2,3,4])
&gt;&gt;&gt; x | y
set([1, 2, 3, 4])
&gt;&gt;&gt; 
</code></pre>

python pandas numpy