Find count of combinations of column in pandas df
<p>i have a table in pandas df</p>

<pre><code>product_id_x   product_id_y
1              2
1              3
1              4
3              7
3              11
3              14
3              2
and so on around (1000 rows)
</code></pre>

<p>i want to find the count of combinations for each product_id_x with product_id_y.</p>

<p>ie. 1 has combinations with 1-2,1-3,1-4(total 3 combinations)
similarly 3 has total 4 combinations.</p>

<p>and create a dataframe df2 which has</p>

<pre><code>product_id_x   combinations
1               3
3               4

and so on ..(distinct product_id_x's)
</code></pre>

<p>what approach should i follow?
my skills on python are at a beginner level.
Thanks in advance.</p>