0

I'm trying to iterate over a queried Pandas dataframe: Column=ORIG_FID. So for every ORIG_FID (0, 1,2,...) I have two rows of (x,y). enter image description here

Then I would like to use ax.plot(x,y) drawing a line that joins every pair of coordinates for every ORIG_FID.

So far I've tried this:

for i in df[df['ORIG_FID'].eq(i)]:
    ax.plot(df[df['x']].values.tolist()[i], df[df['y']].values.tolist()[i])

Note: Also, there is one particular dataframe that doesn't have two rows per ORIG_FID (it can have 2, 3 or whatever number of rows) but the idea is the same, I'd like to plot straight lines for every coordinate in every ORIG_FID value. Thanks in advance.

0 Answers0