Pandas Dataframe: how to add column with number of occurrences in other column
<p>I have to following df:</p>

<pre><code>Col1    Col2
test    Something
test2   Something
test3   Something
test    Something
test2   Something
test5   Something
</code></pre>

<p>I want to get</p>

<pre><code>Col1    Col2          Occur
test    Something     2
test2   Something     2
test3   Something     1
test    Something     2
test2   Something     2
test5   Something     1
</code></pre>

<p>I've tried to use:</p>

<pre><code>df["Occur"] = df["Col1"].value_counts()
</code></pre>

<p>But it didn't help. I've got Occur column full of 'NaN'</p>