title: Pandas how to filter DataFrame on time period
body: <p>I have a file with the below table:</p>
  
  <pre><code>    Name        AvailableDate            totalRemaining
  0   X3321       2018-03-14 13:00:00      200
  1   X3321       2018-03-14 14:00:00      200
  2   X3321       2018-03-14 15:00:00      200
  3   X3321       2018-03-14 16:00:00      200
  4   X3321       2018-03-14 17:00:00      193
  </code></pre>
  
  <p>I wanted to return a DataFrame with all the records in a specific <strong>time</strong> period regardless of the actual <strong>date</strong>.</p>
  
  <p>I followed the example here:</p>
  
  <p><a href="https://stackoverflow.com/questions/35052691/filter-pandas-dataframe-by-time">filter pandas dataframe by time</a></p>
  
  <p>but when I execute the below:</p>
  
  <pre><code>## setup
  import pandas as pd
  import numpy as np
  
  ### Step 2
  ### Check available slots
  file2 = r'C:\Users\user\Desktop\Files\data.xlsx'
  
  slots = pd.read_excel(file2,na_values='')
  
  ## filter the preferred ones
  slots['nextAvailableDate'] = pd.to_datetime((slots['nextAvailableDate']))
  
  
  slots['times'] = pd.to_datetime((slots['nextAvailableDate']))
  slots = slots[slots['times'].between('21:00:00', '02:00:00')]
  </code></pre>
  
  <p>This returns empty DataFrame as well as this solution:</p>
  
  <pre><code>slots = slots[slots['times'].dt.strftime('%H:%M:%S').between('21:00:00', '02:00:00')]
  </code></pre>
  
  <p>Is there a way to do it correctly without creating a columns for time separately? How I should approach this problem please?</p>
  
  <p>My goal:</p>
  
  <pre><code>Name        AvailableDate            totalRemaining
  0   X3321       2018-03-14 21:00:00      200
  1   X3321       2018-03-14 22:00:00      200
  2   X3321       2018-03-14 23:00:00      200
  3   X3321       2018-03-14 00:00:00      200
  4   X3321       2018-03-14 01:00:00      193
  </code></pre>
  
  <p>for every day that appears in the data set.</p>