标签:
@function_performance_statistics(True) # 装饰器 def cg_jx(log_route, dy, w_file, log_name, is_replace=False): act_route = get_route(w_file, log_name, dy) if not is_replace and os.path.exists(act_route.decode(‘utf-8‘)): return False index_name = [‘gain_time‘, ‘coin_type‘, ‘coin_num‘, ‘reason_type‘, ‘template_type‘, ‘client_type‘] index_name_log = [‘,,‘+item+‘=‘ for item in index_name] cond_pat = ‘gain_time=%s.*?uid=\d+‘ % dy # 前面不用加r pd_data = jiexi_two(log_route, dy, index_name_log, index_name, cond_pat) pd_data.to_csv(act_route.decode(‘utf-8‘), index=False) # 写入 return True # 1_1 @function_performance_statistics(True) def login_jx(log_route, dy, w_file, log_name, is_replace=False): act_route = get_route(w_file, log_name, dy) if not is_replace and os.path.exists(act_route.decode(‘utf-8‘)): return False index_name = [‘aid‘, ‘login_type‘] index_name_log = [‘,,‘+item+‘=‘ for item in index_name] cond_pat = ",,login_time=%s.*?,,isFirstLogin=1,," % dy pd_data = jiexi_two(log_route, dy, index_name_log, index_name, cond_pat, sep=‘,,‘) pd_data[‘login_time‘] = dy pd_data = pd_data.drop_duplicates(subset=[‘aid‘]) pd_data.to_csv(act_route.decode(‘utf-8‘), index=False) return True
测试12345
标签:
原文地址:http://www.cnblogs.com/wilson-love/p/5790685.html