presto基础知识

if __name__ == '__main__':
    jt_conf = pd.read_csv(r'/home/iod_etl/BDC/python/jt_biz_position_acklink.csv',delimiter=",",encoding="gbk")
    result=pd.DataFrame(columns=('act_link','PV','UV'))
    begin = sys.argv[1]
    end = sys.argv[2]
    date1 = time.strptime(begin,"%Y%m%d")
    date2 = time.strptime(end,"%Y%m%d")
    date1=datetime(date1[0],date1[1],date1[2])
    date2=datetime(date2[0],date2[1],date2[2])
    inte = date2 - date1
    days = inte.days+1
    for i in range(0,days):
        tmp_date = (date2 + timedelta(days = -i)).strftime("%Y%m%d")
        tmp_data = readWeekData(tmp_date)
        result = pd.concat([result,tmp_data])
    result2 = pd.merge(jt_conf,result,on='act_link',how='left')
    sum_result = result2.groupby(by=['biz','position','big_data_scene_id'])
    print (begin+" - "+end+":\n")
    print (sum_result.sum())
    to_file = sum_result.sum()
    to_file['load_date'] = begin+'-'+end
    out_file = r'/home/iod_etl/BDC/oracle/input/pvuv_'+begin+'-'+end+'.csv'
    to_file.to_csv(out_file, encoding='gbk')

-- WWO ASDF

02-11 01:46