Created
March 15, 2022 12:14
-
-
Save kshirsagarsiddharth/130738fe10c49e4eb37a9edc33994f00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find the distribution of website sessions in morning, afternoon, evening and night | |
%%sql | |
result << | |
SELECT | |
CASE | |
WHEN HOUR(created_at) BETWEEN 7 AND 12 THEN 'morning' | |
WHEN HOUR(created_at) BETWEEN 12 AND 16 THEN 'afternoon' | |
WHEN HOUR(created_at) BETWEEN 16 AND 20 THEN 'evening' | |
ELSE 'night' | |
END AS divide, | |
COUNT(DISTINCT website_session_id) AS sessions | |
FROM | |
orders | |
GROUP BY divide; | |
result = result.DataFrame() | |
px.bar(data_frame=result, x = 'divide', y = 'sessions', template='presentation') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment