0

I'm trying to get the difference between two dates in Pandasql (using a dataframe as table), But it doesn't work.

Code image

the code: query3 = ''' SELECT user_id , transaction_id , amount_in_eur , min(timestamp) , onboarding_completed_at , (min(timestamp)-onboarding_completed_at) FROM new_df WHERE event_kind = 'crypto_withdrawal' GROUP BY user_id HAVING amount_in_eur >= 2000 AND (min(timestamp)-onboarding_completed_at) < 4;

'''

mysql(query3)

I'm using a pandas dataframe!

How can I solve this?

Thank you.

  • 1
    Please include your code as text, not as an image. An image is impossible to debug. [ask] – esqew Dec 14 '21 at 22:58
  • Are you using pandas or an db engine to get the difference ? If the latter, include the db you're using – Lucas Abreu Dec 14 '21 at 23:05
  • @LucasAbreu [pandasql](https://github.com/yhat/pandasql/#querying), the package the asker is using, uses SQLite to run the queries. – Nick ODell Dec 14 '21 at 23:19
  • Thanks, @Nick ODell. This link should help the asker then https://stackoverflow.com/questions/289680/difference-between-2-dates-in-sqlite/14790580. Seems some specifics from SQLite date calculation – Lucas Abreu Dec 14 '21 at 23:25

0 Answers0