weather_data = weather_data.sort_values(['DATE'], axis=0) weather_data.index = range(len(weather_data.index)) return weather_data if __name__ == '__main__': # Add package path to python path at runtime import sys sys.path.append('..') # Or set environment variable # PYTHONPATH=.. from Misc.ComdArgParse import ParseArg files = ParseArg() infile = files['input'] outfile = files['output'] fileName_load = infile if infile is not None else "./WeatherData/WeatherData_Daily_2001-01-01_2014-12-31.csv" fileName_save = outfile if outfile is not None else "../SharedData/WeatherData/Weather_01_14.pkl" WeatherData = pd.read_csv(fileName_load) WeatherVar = [ 'Tsfc_F_avg', 'Rh_PCT_avg', 'Psfc_MB_avg', 'CldCov_PCT_avg', 'Tapp_F_avg', 'Spd_MPH_avg', 'PcpPrevHr_IN' ] WeatherData_sub = filter_data_by_variable(WeatherData, WeatherVar) WeatherData_sub = munge_weather_data(WeatherData_sub)
# -*- coding: utf-8 -*- """ Created on Sat Jan 07 17:55:29 2017 @author: xiaomuliu """ from GroupData import group_temporal_data import cPickle as pickle import re import sys sys.path.append('..') from Misc.ComdArgParse import ParseArg args = ParseArg() inpath = args['input'] outpath = args['output'] params = args['param'] param_match = re.match('(\d+) (\d{4}-\d{2}-\d{2}) (\d{4}-\d{2}-\d{2})', params) group_size = int(param_match.group(1)) startdate, enddate = param_match.group(2), param_match.group(3) filePath_load = inpath if inpath is not None else "../SharedData/311Data/" filePath_save = outpath if outpath is not None else "../SharedData/311Data/" CallTypes = ['Vacant_and_Abandoned_Buildings_Reported','Street_Lights_All_Out',\ 'Alley_Lights_Out','Street_Lights_One_Out'] for calltype in CallTypes: fileName_load = filePath_load + calltype + '_11_14.pkl' with open(fileName_load, 'rb') as input_file: CallsData = pickle.load(input_file)