Skip to content
Advertisement

find timestamp difference between 2 columns with sqldf

According to this answer: https://stackoverflow.com/a/25863597/12304000

We can use something like this in mysql to calculate the time diff between two cols:

How can I achieve the same thing with pandasql? I tried these:

but they throw an error that:

Advertisement

Answer

From the PandaSQL documentation:

pandasql uses SQLite syntax.

The link in your post is for MySQL. Here is a reference for SQLite https://www.sqlite.org/lang.html

The syntax would be like:

"select ROUND((JULIANDAY(startDate) - JULIANDAY(completedDate)) * 1440) from df"

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement