groupby .sum() returns wrong value in pandas
<p>I have a data frame as follows,</p>

<pre><code>Category    Feature valueCount  
    A   color   153  
    A   color   7  
    A   color   48  
    A   color   16  
    B   length  5  
    C   height  1  
    C   height  16  
</code></pre>

<p>I want to get the sum of <code>valueCount</code> by <code>Category</code> and <code>Feature</code>
I am using the following code;</p>

<pre><code>DF['valueSum'] = DF.groupby(['Category','Feature'])['valueCount'].transform('sum')
</code></pre>

<p>I am getting the output as;</p>

<pre><code>Category    Feature valueCount  valueSum
A   color   153 26018
A   color   7   26018
A   color   48  26018
A   color   16  26018
B   length  5   25
C   height  1   257
C   height  16  257
</code></pre>

<p>which is really weird, as it is taking the square of <code>valueCount</code> and then adding up. Anyone knows, what is going wrong here? </p>