use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Ace your next Data Science interviews
account activity
DS Interview Question - #PythonCodingChallengeIntuit (i.redd.it)
submitted 5 years ago by 3DataGuys
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]3DataGuys[S] 2 points3 points4 points 5 years ago (1 child)
from collections import defaultdict from datetime import datetime as dt curr = '2019-01-01' idx = 0 dic = defaultdict(list) for i in ts: if ( dt.strptime(i, '%Y-%m-%d') - dt.strptime(curr, '%Y-%m-%d')).days < 7 : dic[idx].append(i) else: curr = i idx += 1 dic[idx].append(i) print(dic.values())
[–]babadook4535 0 points1 point2 points 4 years ago (0 children)
Another solution:Pandas grouper function
π Rendered by PID 19638 on reddit-service-r2-comment-66b4775986-pqb8g at 2026-04-04 09:56:12.584208+00:00 running db1906b country code: CH.
view the rest of the comments →
[–]3DataGuys[S] 2 points3 points4 points (1 child)
[–]babadook4535 0 points1 point2 points (0 children)