点赞发Nature
关注中Science
最近在做全国煤-电网络的环境排放,想要绘制一个全国煤炭运输的original-destination图。就是画成百度迁徙的那种形式。
代码如下:
import geopandas as gpd
import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
path = r"E:\tencent files\chrome Download\Research\LCA\LCA Coal_fired power plant phaseout\data"
trans_2014 = r"coal_transport2014"
transport_matrix = r"coal_trasport2014.xlsx"
mines = "node_mine_pair.xlsx"
power_plants = "node_power_pair.xlsx"
file = r"Results.xlsx"
trans_mat = pd.read_excel(
os.path.join(path, trans_2014, transport_matrix), index_col=0
).stack()
mine = (
pd.read_excel(os.path.join(path, trans_2014, mines))
.rename(mapper={"node_id": "node_id_mine"}, axis=1)
.groupby(