title: Pandas - Convert HH:MM:SS.F string to seconds - Caveat : HH sometimes goes over 24H
body: <p>I have the following dataframe : </p>
  
  <blockquote>
    <p><code>**flashtalking_df =**</code></p>
  </blockquote>
  
  <pre><code>+--------------+--------------------------+------------------------+
  | Placement ID | Average Interaction Time | Total Interaction Time |
  +--------------+--------------------------+------------------------+
  |      2041083 | 00:01:04.12182           | 24:29:27.500           |
  |      2041083 | 00:00:54.75043           | 52:31:48.89108         |
  +--------------+--------------------------+------------------------+
  </code></pre>
  
  <p>where 00:01:04.12182 = HH:MM:SS.F</p>
  
  <p>I need to convert both columns, Average Interaction Time, and Total Interaction Time into seconds.</p>
  
  <p>The problem is that Total Interaction Time goes over 24h.</p>
  
  <p>I found the following code which works for the most part. However, when the Total Interaction Time goes over 24h, it gives me </p>
  
  <p><code>ValueError: time data '24:29:27.500' does not match format '%H:%M:%S.%f'</code></p>
  
  <p>This is the function I am currently using, which I grabbed from another Stack Overflow question, for both Average Interaction Time and Total Interaction Time:</p>
  
  <pre><code>flashtalking_df['time'] = flashtalking_df['Total Interaction Time'].apply(lambda x: datetime.datetime.strptime(x,'%H:%M:%S.%f'))
  flashtalking_df['timedelta'] = flashtalking_df['time'] - datetime.datetime.strptime('00:00:00.00000','%H:%M:%S.%f')
  flashtalking_df['Total Interaction Time'] = flashtalking_df['timedelta'].apply(lambda x: x / np.timedelta64(1, 's'))
  </code></pre>
  
  <p>If there's an easier way, please let me know.</p>
  
  <p>Thank you for all your help</p>