<s> import datetime <EOL> import numpy as np <EOL> import pandas as pd <EOL> import time <EOL> from polaris . ext import PolarisExtension <EOL> class TimeSeries ( PolarisExtension ) : <EOL> """<STR_LIT>""" <EOL> category = "<STR_LIT>" <EOL> def get ( self , slug , cf = None , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> if not cf : <EOL> cf_to = datetime . date . today ( ) - datetime . timedelta ( <NUM_LIT:1> ) <EOL> cf_from = cf_to - datetime . timedelta ( <NUM_LIT:30> ) <EOL> else : <EOL> _ , cf_from , cf_to = cf . split ( '<STR_LIT:|>' ) <EOL> cf_to = datetime . datetime . strptime ( cf_to , "<STR_LIT>" ) . date ( ) - datetime . timedelta ( <NUM_LIT:1> ) <EOL> func = getattr ( self , "<STR_LIT>" . format ( slug ) ) <EOL> return func ( cf_from = cf_from , cf_to = cf_to , ** kwargs ) <EOL> def get_series ( self , cf_from , cf_to , cols = <NUM_LIT:1> ) : <EOL> date_range = pd . date_range ( cf_from , cf_to ) <EOL> df = pd . DataFrame ( <EOL> np . random . randint ( <NUM_LIT:1> , <NUM_LIT:100> , size = ( len ( date_range ) , cols ) ) , <EOL> index = date_range <EOL> ) <EOL> return df <EOL> def get_series_crossfilter ( self , days , ** kwargs ) : <EOL> cf_to = datetime . date . today ( ) <EOL> cf_from = cf_to - datetime . timedelta ( int ( days ) ) <EOL> return self . get_series ( cf_from , cf_to ) </s>
