File tree 1 file changed +0
-22
lines changed
1 file changed +0
-22
lines changed Original file line number Diff line number Diff line change 6
6
import infra .dask
7
7
import infra .pd
8
8
import infra .platform
9
- import dask .config
10
- import dask .dataframe
11
- import dask .distributed
12
9
import datetime
13
- import math
14
- import numpy as np
15
10
import pandas as pd
16
11
17
- # Configs
18
- day_intervals = 7
19
- # IMPORTANT: Run get_data_range() to update these values when loading in a new dataset!
20
- max_date = infra .constants .MAX_DATE
21
-
22
- def cohort_as_date_interval (x ):
23
- cohort_start = max_date - datetime .timedelta (day_intervals * x + day_intervals - 1 )
24
- cohort_end = max_date - datetime .timedelta (day_intervals * x )
25
-
26
- return cohort_start .strftime ("%Y/%m/%d" ) + "-" + cohort_end .strftime ("%Y/%m/%d" )
27
-
28
- def get_cohort (x ):
29
- return x ["start" ].apply (lambda x_1 : (max_date - x_1 ).days // day_intervals , meta = ('start' , 'int64' ))
30
-
31
- def get_date (x ):
32
- return x ["cohort" ].apply (cohort_as_date_interval , meta = ('cohort' , 'object' ))
33
-
34
12
35
13
def get_registered_users_query (transactions ):
36
14
# Set down the types for the dataframe
You can’t perform that action at this time.
0 commit comments