title: Python Pandas Dataframe Remove Rows by Timedelta Column Value
body: <p>I am trying to remove rows from a dataframe that have a timedelta value of less than some number of seconds.</p>
  
  <p>My dataframe looks something like this:</p>
  
  <pre><code>                  Start     Elapsed time
  0   2018-10-29 07:56:20  0 days 00:15:05
  1   2018-10-29 07:56:20  0 days 00:15:05
  2   2018-10-29 08:11:25  0 days 00:00:02
  3   2018-10-29 08:11:27  0 days 00:00:08
  4   2018-10-29 08:11:27  0 days 00:00:08
  5   2018-10-29 08:11:35  0 days 00:00:02
  6   2018-10-29 08:11:37  0 days 00:00:00
  </code></pre>
  
  <p>I would like to remove all the rows where Elapsed time is less than some number of seconds - let's say 3 for now.  So I'd like a dataframe that looks like this (from the above):</p>
  
  <pre><code>                  Start     Elapsed time
  0   2018-10-29 07:56:20  0 days 00:15:05
  1   2018-10-29 07:56:20  0 days 00:15:05
  3   2018-10-29 08:11:27  0 days 00:00:08
  4   2018-10-29 08:11:27  0 days 00:00:08
  </code></pre>
  
  <p>I've tried a number of different things yielding a number of different error messages - usually incompatible type comparison errors.  For example:</p>
  
  <pre><code>df_new = df[df['Elapsed time'] &gt; pd.to_timedelta('3 seconds')]
  df_new = df[df['Elapsed time'] &gt; datetime.timedelta(seconds=3)]
  </code></pre>
  
  <p>I'd like to avoid iterating over all of the rows, but if that's what I have to do then I'll do that.</p>
  
  <p>Your help is very appreciated!</p>
  
  <p>Edit: My real problem is that the dtype of my 'Elapsed time' column is object instead of timedelta.  A quick fix would be to cast the dtype using the code below, but a better fix would be to ensure that the dtype is not set to the object type in the first place. Thank you all for your help and comments.</p>
  
  <pre><code>df_new = df[pd.to_timedelta(df['Elapsed time']) &gt; pd.to_timedelta('3 seconds')]
  </code></pre>