title: Delta time in pandasql is rounded to days (not showing H, M, S) but H
body: <p>pls, in <strong>pandasql</strong> how to display time difference like in SQL ?</p>
  <p>Example here:<br />
  have this little Station table stored in csv file</p>
  <pre><code>**Train_id  Station Time**  
  110 San Francisco   10:00:00  
  110 Redwood City    10:54:00  
  110 Palo Alto   11:02:00  
  110 San Jose    12:35:00  
  120 San Francisco   11:00:00  
  120 Redwood City  
  120 Palo Alto   12:49:00  
  120 San Jose    13:30:00 
  </code></pre>
  <p>that I have imported as dataframe</p>
  <pre><code>    station = pd.read_excel(&quot;Station.xlsx&quot;)  
      station. head()
  
   
  0,110,San Francisco,10:00:00  
  1,110,Redwood City,10:54:00  
  2,110,Palo Alto,11:02:00  
  3,110,San Jose,12:35:00  
  4,120,San Francisco,11:00:00  
  5,120,Redwood City,NaN  
  6,120,Palo Alto,12:49:00  
  7,120,San Jose,13:30:00  
  </code></pre>
  <p>well ... so far so good, it looks fine!</p>
  <p>Now, in SQL this query</p>
  <pre><code>SELECT 
      train_id, 
      station,
      time as &quot;station_time&quot;,
      lead(time) OVER (PARTITION BY train_id ORDER BY time) - time 
          AS time_to_next_station
  FROM train_schedule;
  </code></pre>
  <p>have this resul</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Train_id(integer)</th>
  <th>station(characher varyng(20))</th>
  <th>station_time(time without time zone)</th>
  <th>time_to_next_station(inteval)</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>110</td>
  <td>San Francisco</td>
  <td>10:00:00</td>
  <td>00:54:00</td>
  </tr>
  <tr>
  <td>110</td>
  <td>Redwood City</td>
  <td>10:54:00</td>
  <td>00:08:00</td>
  </tr>
  <tr>
  <td>110</td>
  <td>Palo Alto</td>
  <td>11:02:00</td>
  <td>01:33:00</td>
  </tr>
  <tr>
  <td>110</td>
  <td>San Jose</td>
  <td>12:35:00</td>
  <td></td>
  </tr>
  <tr>
  <td>120</td>
  <td>San Francisco</td>
  <td>11:00:00</td>
  <td>01:49:00</td>
  </tr>
  <tr>
  <td>120</td>
  <td>Palo Alto</td>
  <td>12:49:00</td>
  <td>00:41:00</td>
  </tr>
  <tr>
  <td>120</td>
  <td>San Jose</td>
  <td>13:30:00</td>
  <td></td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>So the delay time is readable in HH:MM:SS</p>
  <p>But in <strong>pandasql</strong> when i try this</p>
  <pre><code> query =&quot;&quot;&quot;
  select
      Train_id,
      Station,
      Time as station_time,
      lead(Time) over(partition by Train_Id order by Time) - Time   as time_to_next_station
  from station
  
  &quot;&quot;&quot;
  
  sqldf(query)
  </code></pre>
  <p>the results</p>
  <ul>
  <li>is not showing the inteval with min and seconds  , only hour part</li>
  <li>the Time variable shows .00000 at the right side</li>
  <li>and there is one more row</li>
  </ul>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Train_id</th>
  <th>Station</th>
  <th>station_time</th>
  <th>time_to_next_station</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>110</td>
  <td>San Francisco</td>
  <td>10:00:00.000000</td>
  <td>0.0</td>
  </tr>
  <tr>
  <td>110</td>
  <td>Redwood City</td>
  <td>10:54:00.000000</td>
  <td>1.0</td>
  </tr>
  <tr>
  <td>110</td>
  <td>Palo Alto</td>
  <td>11:02:00.000000</td>
  <td>1.0</td>
  </tr>
  <tr>
  <td>110</td>
  <td>San Jose</td>
  <td>12:35:00.000000</td>
  <td>NaN</td>
  </tr>
  <tr>
  <td>120</td>
  <td>Redwood City</td>
  <td>None</td>
  <td>NaN</td>
  </tr>
  <tr>
  <td>120</td>
  <td>San Francisco</td>
  <td>11:00:00.000000</td>
  <td>1.0</td>
  </tr>
  <tr>
  <td>120</td>
  <td>Palo Alto</td>
  <td>12:49:00.000000</td>
  <td>1.0</td>
  </tr>
  <tr>
  <td>120</td>
  <td>San Jose</td>
  <td>13:30:00.000000</td>
  <td>NaN</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>i have tried different way to resolve this (ie. casting types to datetime outside query, inside the query )  but nothing.
  These sql windows function on time data are very powerfull , how can be replicated in pandasql?</p>
  <p>Any suggestion pls?
  Thank you very much</p>