def deviceid_package_start_close_train(deviceid, app_id='0'): sql = 'select * from deviceid_package_start_close where device_id=\"' sql = sql + deviceid + '\" ' sql = sql + 'and app_id=\"' sql = sql + app_id + '\"' ret = data_from_mysql(sql) return ret
def augmentatio_deviceid_packages(): # sql='alter table deviceid_train add n_class int(4) default 0' # ret=data_from_mysql(sql) # print(ret.head(3)) sql='select * from deviceid_train' package_label=data_from_mysql(sql) deviceid_packages=pd.read_csv(file_path+'deviceid_packages.csv') cols=deviceid_packages.columns deviceid_packages=pd.merge(deviceid_packages,package_label,on=['device_id'],how='left') deviceid_packages=data_augmentation(deviceid_packages) logging.debug(deviceid_packages.shape) deviceid_packages.to_csv(file_path+'deviceid_packages.csv',columns=cols,index= False)
def dev_id_train(): sql = 'select * from deviceid_train' deviceid_train = data_from_mysql(sql) return deviceid_train
def deviceid_package_start_close_train(deviceid): sql = 'select * from deviceid_package_start_close where device_id=\"' sql = sql + deviceid + '\" ' # print(sql) ret = data_from_mysql(sql) return ret