T85_code/extract_plant.ipynb

4.2 KiB

In [1]:
import pandas as pd
In [2]:
import os
In [3]:
files = [x for x in os.listdir('./火电20230313/火电20230313F/') if '经济性' in x]
In [5]:
plants = [x.split('-')[0].strip() for x in files]
In [6]:
old_plants = pd.read_excel('./lat_lon.xlsx')
old_plants.head()
Out[6]:
plant 经度 纬度
0 万方发电厂(焦作爱依斯万方电力有限公司) 113.381649 35.255622
1 三河发电有限责任公司 116.860260 39.953617
2 上海上电漕泾发电有限公司 121.407593 30.765242
3 上海吴泾发电有限责任公司 121.471140 31.065113
4 上海吴泾第二发电有限责任公司 121.471340 31.062532
In [8]:
new_plants = [x for x in plants if x not in old_plants.plant.values]
In [9]:
with open('./plant.txt', 'w', encoding='utf-8') as fw:
    for plant in new_plants:
        fw.write(plant)
        fw.write('\n')
In [ ]: