风场映射.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import time
  2. import pandas as pd
  3. fengchang_map = {'平陆': 'WOF35900004', '阳曲': 'WOF35100072', '古交': 'WOF35100073', '马家梁': 'WOF35200074',
  4. '太谷': 'WOF35200075', '坡底': 'WOF35900076', '西潘': 'WOF35300077', '芮城': 'WOF35900078',
  5. '右玉': 'WOF34900079', '贺家沟': 'WOF35800080', '石楼': 'WOF35800081', '盂县': 'WOF35800082',
  6. '富风': 'WOF35200075'
  7. }
  8. wind_farms = {
  9. "WOF35900004": "平陆风电场",
  10. "WOF35100072": "阳曲风电场",
  11. "WOF35100073": "古交风电场",
  12. "WOF35200074": "马家梁风电场",
  13. "WOF35400075": "太谷风电场",
  14. "WOF35900076": "坡底风电场",
  15. "WOF35300077": "西潘风电场",
  16. "WOF35900078": "芮城风电场",
  17. "WOF34900079": "右玉风光互补电站",
  18. "WOF35800080": "贺家沟",
  19. "WOF35800081": "石楼风电场",
  20. "WOF35800082": "盂县风光互补电站"
  21. }
  22. begin = time.time()
  23. df = pd.read_excel(r'C:\Users\wzl\Desktop\中广核104测点\0416部署需要\最终测点配置.xlsx')
  24. print(time.time() - begin)
  25. selet_cols = ['场站', '风机号', '标准化中文', '遥测别名', 'en_name']
  26. now_df = df[selet_cols]
  27. now_df['场站'] = now_df['场站'].apply(lambda x: x if x != '富风' else '太古')
  28. now_df['场站标准化编号'] = df['场站'].map(fengchang_map)
  29. now_df['风机号'] = now_df['风机号'].apply(lambda x: int(x.replace('WTG', '')))
  30. now_df.reset_index(inplace=True)
  31. now_df.rename(columns={'en_name': '标准化英文', 'index': '顺序号'}, inplace=True)
  32. result_select = ['顺序号', '场站', '场站标准化编号', '风机号', '遥测别名', '标准化中文', '标准化英文']
  33. print(now_df[result_select])
  34. now_df[result_select].to_excel('../conf/测点表.xlsx', columns=result_select, index=False)