title: Pandas find hourly rolling average
body: <p>My dataset <code>df</code> looks like this. It is a <code>minute</code> based dataset.</p>
  
  <pre><code>time, Open, High
  2017-01-01 00:00:00, 1.2432, 1.1234
  2017-01-01 00:01:00, 1.2432, 1.1234
  2017-01-01 00:02:00, 1.2332, 1.1234
  2017-01-01 00:03:00, 1.2132, 1.1234
  ...., ...., ....
  2017-12-31 23:59:00, 1.2132, 1.1234
  </code></pre>
  
  <p>I want to find the hourly <code>rolling mean</code> for <code>Open</code> column but it should be flexible so that I can also find hourly <code>rolling mean</code> for other columns.</p>
  
  <p>What did I do?</p>
  
  <p>I am able to find the <code>daily rolling average</code> like given below:</p>
  
  <pre><code># Pandas code to find the rolling mean for a single day
  
  df
  .assign(1davg=df.rolling(window=1*24*60)['Open'].mean()) 
  .groupby(df['time'].dt.date) 
  .last() 
  </code></pre>
  
  <p>Please note that changing this(<code>window=1*24*60</code> to <code>window=60</code>) line of code does not work because I already tried it.</p>
  
  <p>The new <code>output</code> should look like this:</p>
  
  <pre><code>time,                 Open,  High,   Open_hour_avg
  2017-01-01 00:00:00, 1.2432, 1.1234,   1.2532
  2017-01-01 01:00:00, 1.2432, 1.1234,   1.2632    
  2017-01-01 02:00:00, 1.2332, 1.1234,   1.2332
  2017-01-01 03:00:00, 1.2132, 1.1234,   1.2432
  ...., ...., ...., ....
  2017-12-31 23:00:00, 1.2132, 1.1234,   1.2232
  </code></pre>
  
  <p>here,</p>
  
  <p><code>2017-01-01 00:00:00, 1.2432, 1.1234,   1.2532</code> is the <code>minute</code> average data for <code>midnight</code> </p>
  
  <p>and <code>2017-01-01 01:00:00, 1.2432, 1.1234, 1.2632</code> is the <code>minute</code> average data for <code>1 AM</code> </p>