How to get the difference between two 24 hour times?
<p>Is there a simple way in pandas to tell the difference between 24 hour times as follows:</p>

<pre><code>9:45 17:10
</code></pre>

<p>The difference is 7 hours and 25 minutes which is 445 minutes.</p>

<p>I think you can also use the Python standard library <code>datetime.datetime</code> without installing the pandas.</p>

<pre><code>&gt;&gt;&gt; t1 = datetime.datetime.strptime('09:45', '%H:%M')
&gt;&gt;&gt; t2 = datetime.datetime.strptime('17:10', '%H:%M')
&gt;&gt;&gt; t1
datetime.datetime(1900, 1, 1, 9, 45)
&gt;&gt;&gt; t2
datetime.datetime(1900, 1, 1, 17, 10)
&gt;&gt;&gt; td = t2 - t1
&gt;&gt;&gt; td.total_seconds()
26700.0
&gt;&gt;&gt; str(td)
'7:25:00'
</code></pre>

python pandas