title: Pandas: Compute sum of values for each unique element ('ID') in a given timeframe and then compute the median across all 'ID's
body: <p>I am working on a dataset containing data from taxi rides in the city of Chicago. The data contains information per trip such as Taxi ID, Timestamp, Fare etc. among others. A sample of the data is shown below from <code>df.head()</code> with the timestamps in pandas datetime:</p>
  
  <pre><code>                                            Taxi ID     Pickup Community Area   Trip Total
  Trip End Timestamp          
  2016-04-25 18:00:00     bfec2c659fcbed3b508dc6caaf6f7ef39e17801e8ca0cc...   8.0     16.00
  2016-11-16 15:45:00     f45c4bfa9d6c445eb03ab69093f7ec1e9cdecef83cb2ce...   32.0    9.75
  2016-01-15 17:45:00     ecfb6f2cdce5d4c4e80218f58070ae719060ee47e648f4...   32.0    14.75
  2016-01-20 21:30:00     7d8179131ea9952793af4cda8635e94b56c2b92d3c376c...   32.0    7.25
  2016-02-11 09:15:00     d5c4fbae1c0c510364404a90fd477b19f7f03408ce40ff...   35.0    18.75
  </code></pre>
  
  <p>Assuming I have data for one week, I want to achieve this:</p>
  
  <ol>
  <li>Consider a user-chosen binning choice: e.g.: hour.</li>
  <li>Group the data by taxi ID, and sum up the amount made by each taxi within that one hour.</li>
  <li>Compute the median of all such 'hourly revenues' between all taxis according to taxi ID (still within that one hour).</li>
  <li>Repeat for each hour in the timeframe. For a week, this is 24*7 = 168 times.</li>
  <li>Plot the median per hour across all hours in the week.</li>
  </ol>
  
  <p>This can be extended to hours in a week, weeks in a year etc. </p>
  
  <p>As of now, I am able to use <code>pivot_table</code> to, say, obtain the median revenue per hour of the day over the whole timeframe (but this is not for every hour in the week), or <code>resample</code> to obtain the median fare over time (but this is not 'hourly revenue' of the taxis, this is the median fare per trip). Neither of those would achieve exactly what I want, how should I implement this?</p>