title: How to bin groupeby counts in pandas?
body: <p>After days of research I am stuck.  Am new to Python/Pandas.  Trying to convert data analysis from multiple excel sheets to a python solution.</p>
  
  <p>I am calculating the learning curve for new people in particular skills.  To do this I have the following dataset:</p>
  
  <ul>
  <li>COMM_ID - unique numeric identifier per communication</li>
  <li>SKILL - the category of communication - text</li>
  <li>LOGIN - login for the person - text</li>
  <li>OFFERS - was a survey sent, 1 or 0</li>
  <li>RESPONSES - was there a response to the survey, 1 or 0</li>
  <li>NOs - was the response negative, 1 or 0</li>
  </ul>
  
  <p>In the below I build the dataframe, sort by SKill, Login and then COMM_ID.  The COMM_ID puts it in chronological order.  Then I groupby Skill and Login.</p>
  
  <p>How would I take the dataframe and cut the data into two dataframes? One for responses and the other for Nos, for each combination of skill and login with bins of 50 increments.  Need to look at each segment of 50 COMM_IDs (50, 100, 150) and count how many 1s are in each of those segement.  This would be for every skill/login combo.  The SUM of the 1s would then go in the dataframe per the bins.</p>
  
  <p>I have tried variations of pandas.cut to no success.</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import odbc
  from pandas import DataFrame
  
  #Call ODBC connection
  db = odbc.odbc('HID')
  
  # SQL Query to get data
  sqlRRAgentSkill = """ 
  SELECT
  COMM_ID, 
  SKILL, 
  LOGIN, 
  OFFERS, 
  RESPONSES,
  NOs
  FROM 
  2013_2014;
  """
  
  #Call SQL 
  RRdata = pd.read_sql_query(sqlRRAgentSkill,db)
  
  #Sort data
  RRDataSorted = RRdata.sort_index(ascending=[True,True,True], by = ['SKILL', 'LOGIN', 'COMM_ID'])
  
  # Group data by Skill and Login
  grouped = RRDataSorted.groupby(['SKILL', 'LOGIN'])
  
  # Bins for contacts
  startBin = 0
  stopBin = 1000
  incrementBin = 50
  sortbins = np.arange(startBin, stopBin + incrementBin, incrementBin)
  </code></pre>