title: python pandas resample count and sum
body: <p>I have data by date and want to create a new dataframe by week with sum of sales and count of categories. </p>
  
  <pre><code>#standard packages
  import numpy as np
  import pandas as pd
  
  #visualization
  %matplotlib inline
  import matplotlib.pylab as plt
  
  #create weekly datetime index
  edf = pd.read_csv('C:\Users\j~\raw.csv', parse_dates=[6])
  edf2 = edf[['DATESENT','Sales','Category']].copy()
  edf2
  
  #output
  
  DATESENT    |  SALES  | CATEGORY
  2014-01-04      100        A
  2014-01-05      150        B
  2014-01-07      150        C
  2014-01-10      175        D
  
  #create datetime index of week
  edf2['DATESENT']=pd.to_datetime(edf2['DATESENT'],format='%m/%d/%Y')
  edf2 = edf2.set_index(pd.DatetimeIndex(edf2['DATESENT']))
  edf2.resample('w').sum()
  edf2
  
  #output
  
              SALES CATEGORY 
  DATESENT     
  2014-01-05  250      AB
  2014-01-12  325      CD
  </code></pre>
  
  <p>But I am looking for </p>
  
  <pre><code>           SALES CATEGORY 
  DATESENT     
  2014-01-05  250      2
  2014-01-12  325      2
  </code></pre>
  
  <p>This didn't work ... </p>
  
  <pre><code>edf2 = e2.resample('W').agg("Category":len,"Sales":np.sum)
  </code></pre>
  
  <p>Thank you</p>