title: Get list of of Hours Between Two Datetime Variables
body: <p>I have a dataframe that looks like this: </p>
  
  <pre><code>Date               Name  Provider     Task      StartDateTime       LastDateTime
  2020-01-01 00:00:00 Bob     PEM   ED A 7a-4p    2020-01-01 07:00:00 2020-01-01 16:00:00
  2020-01-02 00:00:00 Tom     PEM   ED C 10p-2a   2020-01-02 22:00:00 2020-01-03 02:00:00
  </code></pre>
  
  <p>I would like to list the number of hours between each person's <code>StartDateTime</code> <code>LastDateTime</code>(datetime64[ns]) and then create an updated dataframe to reflect said lists. So for example, the updated dataframe would look like this:</p>
  
  <pre><code>Name    Date         Hour
  Bob     2020-01-01    7
  Bob     2020-01-01    8
  Bob     2020-01-01    9
  ...
  Tom     2020-01-02    22
  Tom     2020-01-02    23
  Tom     2020-01-03    0
  Tom     2020-01-03    1
  ...
  </code></pre>
  
  <p>I honestly do not have a solid idea where to start, I've found some articles that may provide a foundation but I'm not sure how to adapt my query to the below code since I want the counts based on the row and hour values.  </p>
  
  <pre><code>def daterange(date1, date2):
      for n in range(int ((date2 - date1).days)+1):
          yield date1 + timedelta(n)
  
  start_dt = date(2015, 12, 20)
  end_dt = date(2016, 1, 11)
  for dt in daterange(start_dt, end_dt):
      print(dt.strftime("%Y-%m-%d"))
  </code></pre>
  
  <p><a href="https://www.w3resource.com/python-exercises/date-time-exercise/python-date-time-exercise-50.php" rel="nofollow noreferrer">https://www.w3resource.com/python-exercises/date-time-exercise/python-date-time-exercise-50.php</a></p>