title: Pandas filter df by date range and condition
body: <p>I have a dataframe that contains 3 datetime columns</p>
  <pre><code>              ItemUid   HireStart    DCompleteDate       OffHire
                14055     2021-01-01       2021-12-17      2021-01-09
                14065     2021-08-12       2021-12-17      2021-11-17
                14534     2018-12-21             NaT             NaT
                11639           NaT              NaT             NaT
                43268     2020-09-07       2020-09-03      2020-11-03
                36723     2021-01-03             Nat       2021-01-10
               
  </code></pre>
  <p>I am trying to return a dataframe that returns the items that were on hire between a user inputted date range.</p>
  <p>Ie: if the user inputs: start date = '2021-01-02' &amp; end date = '2021-01-08' the expected result would be:</p>
  <pre><code>          ItemUid   HireStart    DCompleteDate       OffHire
            14055     2021-01-01       2021-01-23      2021-01-09
            14534     2018-12-21             NaT             NaT
            36723     2021-01-03             Nat       2021-01-10
               
  </code></pre>
  <p><strong>My code :)</strong></p>
  <pre><code>def date_range(df):
      start_date = input(&quot;Enter start date dd/mm/yyyy: &quot;)
      end_date = input(&quot;Enter end date dd/mm/yyyy: &quot;)
  
      df = df[(df['OffHire'] &lt;= end_date) &amp; 
               ((df['HireStart'].notna()) | (df['HireStart'] &gt;= start_date))]
      
      return df
  
  result = df_hire.apply(date_range, axis=1)
  </code></pre>
  <p>This is currently getting an error:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-60-6d4d17020cba&gt; in &lt;module&gt;()
        9     return df
       10 
  ---&gt; 11 result = df_hire.apply(date_range, axis=1)
  
  4 frames
  &lt;ipython-input-60-6d4d17020cba&gt; in date_range(df)
        3     end_date = input(&quot;Enter end date dd/mm/yyyy: &quot;)
        4 
  ----&gt; 5     df = df[(df['OffHire'] &lt;= end_date) &amp; 
        6              ((df['HireStart'].notna()) | (df['HireStart'] &gt;= start_date))]
        7 
  
  TypeError: '&lt;=' not supported between instances of 'Timestamp' and 'str'
  </code></pre>
  <p>I could probably fix the error, however the implementation of how to apply the function has me stuck!</p>
  <p><strong>Any help would be greatly appreciated and would be another lesson for me!</strong></p>
  <p>Thanks in advance</p>