【发布时间】:2019-10-07 20:18:08
【问题描述】:
我需要画一条连接数据框中两个点的线(在下表中,一条连接 S01 到 S02、S01 到 S04、S03 到 S04 等的线)点不能明确定义,而是通过迭代数据框。每行中的坐标是“到”点的坐标。
这是我迄今为止尝试过的:
df = pd.read_csv(1234.csv')
for index, row in df.iterrows():
x_coords = [df.loc["from", "x"], df.loc["to", "x"]]
y_coords = [df.loc["from", "y"], df.loc["to", "y"]]
plt.plot(x_coords, y_coords,'grey', linewidth=0.5)
【问题讨论】:
-
邮政编码和数据,而不是代码/数据的图像
标签: python pandas dataframe indexing