title: Сorrect indexing of time intervals
body: <p>I'm new in pandas and trying to make aggregation. I converted Dataframe to date format and made indexing change for every day.</p>
  <pre><code>
  model['time_only'] = [time.time() for time in model['date']]
  model['date_only'] = [date.date() for date in model['date']]
  
  model['cumsum'] = ((model['date_only'].diff() == datetime.timedelta(days=1))*1).cumsum()
  
  def get_out_of_market_data(data):
      df = data.copy()
      
      start_market_time = datetime.time(hour=13,minute=30)
      end_market_time = datetime.time(hour=20,minute=0)
  
      df['time_only'] = [time.time() for time in df['date']]
      df['date_only'] = [date.date() for date in df['date']]
  
      cond = (start_market_time &gt; df['time_only']) | (df['time_only'] &gt;= end_market_time)
      return data[cond]
  
  
  model['date'] = pd.to_datetime(model['date'])
  new = model.drop(columns=['time_only', 'date_only'])
  get_out_of_market_data(data=new).head(20)
  </code></pre>
  <p>what i get</p>
  <pre><code>   0    0   65.5000 65.50   65.5000 65.500  DD  1   125 65.500000   2016-01-04 13:15:00 0
     26   26  62.7438 62.96   62.6600 62.956  DD  1639    174595  62.781548   2016-01-04 20:00:00 0
     27   27  62.5900 62.79   62.5300 62.747  DD  2113    268680  62.650260   2016-01-04 20:15:00 0
     28   28  62.7950 62.80   62.5400 62.590  DD  2652    340801  62.652640   2016-01-04 20:30:00 0
     29   29  63.1000 63.12   62.7800 62.800  DD  6284    725952  62.963512   2016-01-04 20:45:00 0
     30   30  63.2200 63.22   63.0700 63.080  DD  21  699881  63.070114   2016-01-04 21:00:00 0
     31   31  63.2200 63.22   63.2200 63.220  DD  7   1973    63.220000   2016-01-04 22:00:00 0
     32   32  63.4000 63.40   63.4000 63.400  DD  2   150 63.400000   2016-01-05 00:30:00 1
     33   33  62.3700 62.37   62.3700 62.370  DD  3   350 62.370000   2016-01-05 11:00:00 1
     34   34  62.1000 62.37   62.1000 62.370  DD  2   300 62.280000   2016-01-05 11:15:00 1
     35   35  62.0800 62.08   62.0800 62.080  DD  1   100 62.080000   2016-01-05 11:45:00 1
     
  </code></pre>
  <p>the last two columns are the time interval from 20:00 to 13:30 with the indexes of change of each day and the indices of change of the day</p>
  <p>I tried to group by the last column the interval from 20:00 one day to 13:00 the next with indexing each interval through the groupbuy
  I do not fully understand the method, but for example
  <code>new.groupby(pd.Grouper(freq='17hours'))</code></p>
  <p>how to move the indexing to this interval ?</p>