Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- query = '''
- SELECT user_id,
- COUNT (counts) AS counts_per_user
- FROM (SELECT user_id,
- count (id) AS active_days,
- DATE_TRUNC('day', creation_date::date) AS day
- FROM stackoverflow.posts
- WHERE creation_date::date BETWEEN '2008-12-01' AND '2008-12-07'
- GROUP BY user_id, DATE_TRUNC('day', creation_date::date)
- ORDER BY day) AS counts
- GROUP BY user_id
- '''
- test = pd.read_sql_query(query, con=engine)
- test.head(10)
- test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement