149 lines
4.2 KiB
Plaintext
149 lines
4.2 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"outputs": [],
|
|
"source": [
|
|
"import pandas as pd"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"outputs": [],
|
|
"source": [
|
|
"import os"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"outputs": [],
|
|
"source": [
|
|
"files = [x for x in os.listdir('./火电20230313/火电20230313F/') if '经济性' in x]"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"outputs": [],
|
|
"source": [
|
|
"plants = [x.split('-')[0].strip() for x in files]"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": " plant 经度 纬度\n0 万方发电厂(焦作爱依斯万方电力有限公司) 113.381649 35.255622\n1 三河发电有限责任公司 116.860260 39.953617\n2 上海上电漕泾发电有限公司 121.407593 30.765242\n3 上海吴泾发电有限责任公司 121.471140 31.065113\n4 上海吴泾第二发电有限责任公司 121.471340 31.062532",
|
|
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>plant</th>\n <th>经度</th>\n <th>纬度</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>万方发电厂(焦作爱依斯万方电力有限公司)</td>\n <td>113.381649</td>\n <td>35.255622</td>\n </tr>\n <tr>\n <th>1</th>\n <td>三河发电有限责任公司</td>\n <td>116.860260</td>\n <td>39.953617</td>\n </tr>\n <tr>\n <th>2</th>\n <td>上海上电漕泾发电有限公司</td>\n <td>121.407593</td>\n <td>30.765242</td>\n </tr>\n <tr>\n <th>3</th>\n <td>上海吴泾发电有限责任公司</td>\n <td>121.471140</td>\n <td>31.065113</td>\n </tr>\n <tr>\n <th>4</th>\n <td>上海吴泾第二发电有限责任公司</td>\n <td>121.471340</td>\n <td>31.062532</td>\n </tr>\n </tbody>\n</table>\n</div>"
|
|
},
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"old_plants = pd.read_excel('./lat_lon.xlsx')\n",
|
|
"old_plants.head()"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"outputs": [],
|
|
"source": [
|
|
"new_plants = [x for x in plants if x not in old_plants.plant.values]"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"outputs": [],
|
|
"source": [
|
|
"with open('./plant.txt', 'w', encoding='utf-8') as fw:\n",
|
|
" for plant in new_plants:\n",
|
|
" fw.write(plant)\n",
|
|
" fw.write('\\n')"
|
|
],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"outputs": [],
|
|
"source": [],
|
|
"metadata": {
|
|
"collapsed": false,
|
|
"pycharm": {
|
|
"name": "#%%\n"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 2
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython2",
|
|
"version": "2.7.6"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0
|
|
} |