How to aggregate values of pandas series
<h3>Data manipulation using pandas</h3>

<p>Anyone having bright ways to manipulate the values of concatenated pandas series to find total counts?  </p>

<hr>

<p>Current data (type: <code>pandas.core.series.Series</code>) 
FYI, this data is generated by using 'groupby' function from the raw data.</p>

<pre><code>date          device        
2015-07-08    a         0        
              b         0        
              c         0        
              d         1        
2015-07-09    a         0        
              c         1         
              d         1        
2015-07-10    a         1        
              b         1        
              c         1        
</code></pre>

<p>Expected result (type: <code>pandas.core.series.Series</code>)<br>
Value of each device denotes the total number of counts up to date A.<br>
As an example, total(2015-07-10, c) = 2 because (2015-07-09, c) = 1 and (2015-07-10, c) = 1</p>

<pre><code>date          device    
2015-07-08    a         0
              b         0
              c         0
              d         1
2015-07-09    a         0
              c         1 
              d         2
2015-07-10    a         1
              b         1
              c         2
</code></pre>

<p>I think you can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.core.groupby.DataFrameGroupBy.cumsum.html" rel="nofollow"><code>DataFrameGroupBy.cumsum</code></a> with <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.groupby.html" rel="nofollow"><code>groupby</code></a> by second level:</p>

<pre><code>dates = pd.DatetimeIndex(['2015-07-08','2015-07-08','2015-07-08','2015-07-08',
                          '2015-07-09','2015-07-09','2015-07-09',
                          '2015-07-10','2015-07-10','2015-07-10'])
devices = ['a','b','c','d','a','c','d','a','b','c']
idx = pd.MultiIndex.from_tuples(list(zip(dates, devices)), names=['date', 'device'])
s = pd.Series([0,0,0,1,0,1,1,1,1,1], index= idx)
print (s)
date        device
2015-07-08  a         0
            b         0
            c         0
            d         1
2015-07-09  a         0
            c         1
            d         1
2015-07-10  a         1
            b         1
            c         1
dtype: int64

print (s.groupby(level=1).cumsum())
date        device
2015-07-08  a         0
            b         0
            c         0
            d         1
2015-07-09  a         0
            c         1
            d         2
2015-07-10  a         1
            b         1
            c         2
dtype: int64
</code></pre>

python pandas series multi-index cumsum