import time import pandas as pd fengchang_map = {'平陆': 'WOF35900004', '阳曲': 'WOF35100072', '古交': 'WOF35100073', '马家梁': 'WOF35200074', '太谷': 'WOF35200075', '坡底': 'WOF35900076', '西潘': 'WOF35300077', '芮城': 'WOF35900078', '右玉': 'WOF34900079', '贺家沟': 'WOF35800080', '石楼': 'WOF35800081', '盂县': 'WOF35800082', '富风': 'WOF35200075' } wind_farms = { "WOF35900004": "平陆风电场", "WOF35100072": "阳曲风电场", "WOF35100073": "古交风电场", "WOF35200074": "马家梁风电场", "WOF35400075": "太谷风电场", "WOF35900076": "坡底风电场", "WOF35300077": "西潘风电场", "WOF35900078": "芮城风电场", "WOF34900079": "右玉风光互补电站", "WOF35800080": "贺家沟", "WOF35800081": "石楼风电场", "WOF35800082": "盂县风光互补电站" } begin = time.time() df = pd.read_excel(r'C:\Users\wzl\Desktop\中广核104测点\0416部署需要\最终测点配置.xlsx') print(time.time() - begin) selet_cols = ['场站', '风机号', '标准化中文', '遥测别名', 'en_name'] now_df = df[selet_cols] now_df['场站'] = now_df['场站'].apply(lambda x: x if x != '富风' else '太古') now_df['场站标准化编号'] = df['场站'].map(fengchang_map) now_df['风机号'] = now_df['风机号'].apply(lambda x: int(x.replace('WTG', ''))) now_df.reset_index(inplace=True) now_df.rename(columns={'en_name': '标准化英文', 'index': '顺序号'}, inplace=True) result_select = ['顺序号', '场站', '场站标准化编号', '风机号', '遥测别名', '标准化中文', '标准化英文'] print(now_df[result_select]) now_df[result_select].to_excel('../conf/测点表.xlsx', columns=result_select, index=False)