Skip to content
Advertisement

Tag: time-series

Track state of time series event in SQL column

This seems really simple but I can’t figure it out, working in SQL Server. I have time series data and I want a column to track the state of ON/OFF events for each row, so when there’s an ON event then the Desired Output column will have a 1 for each subsequent event until there is an OFF event. Please

Is there a way to run posqresql queries in a pandas dataframe?

I have pandas dataframe like this : created_at lat long hex_ID 0 2020-10-13 15:12:18.682905 28.690628 77.323285 883da1ab0bfffff 1 2020-10-12 22:49:05.886170 28.755408 77.112289 883da18e87fffff 2 2020-10-13 15:24:17.692375 28.690571 77.323335 883da1ab0bfffff 3 2020-10-12 23:21:13.700226 28.589922 77.082738 883da112a1fffff 4 2020-10-13 15:43:58.887592 28.649227 77.339063 883da1a941fffff and I want to convert it like this created_at hex_id count 0 2020-10-28 22:00:00 883da11185fffff 4 1 2020-09-09 10:00:00

How do I create cohorts of users from month of first order, then count information about those orders in SQL?

I’m trying to use SQL to: Create user cohorts by the month of their first order Sum the total of all the order amounts bought by that cohort all-time Output the cohort name (its month), the cohort size (total users who made first purchase in that month), total_revenue (all order revenue from the users in that cohort), and avg_revenue (the

Advertisement