def get_shop_trend_zero_anomaly_filled(shop_id, continuous_zero_filled_threshold=5, consider_anomaly=True): HOME = getHome() source_folder = os.path.join(HOME, "Dropbox", "dataset", "Analysis", "PayTrend_Filled_threshold_%s_%s_anomaly" % ( continuous_zero_filled_threshold, "consider" if consider_anomaly else "not_consider")) source_file = os.path.join(source_folder,"Customer_Flow_zeroFilled_shop_%s.csv"%shop_id) if not os.path.exists(source_file): #print 100101 print "Generating: %s\n"%source_file sys.path.append(os.path.join(HOME, "Dropbox", "dataset", "Scripts")) import TrendForEveryShop as tfes tfes.get_Customer_flow_per_shop_missingdays_handled('mean', shop_id, continuous_zero_filled_threshold, consider_anomaly) #print source_file df = pd.read_csv(source_file, header=None, names=['time', 'orig_cnt', 'cnt'], parse_dates=[0]) df.drop('orig_cnt', inplace=True, axis=1) df['day'] = df.apply(lambda row: row['time'].date(), axis=1) df.drop('time', axis=1, inplace=True) return df[['day','cnt']]
def inner_function(shop_id): """shop_static_info""" FILE = os.path.join(getHome(), "Dropbox", "dataset", "Analysis", "Features", "shop_info_feature.csv") df = pd.read_csv(FILE) df = df[df['shop_id']==shop_id] return df
def inner_function(shop_id): FILE = os.path.join(getHome(), "Dropbox", "dataset", "Analysis", "Features", "shop_info_feature.csv") return pd.read_csv(FILE)
def get_city_to_daily_aqi(): PKL_file = os.path.join(getHome(),'Dropbox','dataset','Scripts','weather','city_to_daily_aqi.pkl') return pickle.load(open(PKL_file,'rb'))
def get_shop_2_city(): PKL_file = os.path.join(getHome(),'Dropbox','dataset','Scripts','weather','shop_2_city.pkl') return pickle.load(open(PKL_file,'rb'))