How do I fix the following df.query line to stop getting the error msg: name 'z' is not defined.
I have data in 3 columns and wanna plot 3D polygons. I run a loop to pair up (X, Y), in which I try to use the loop variable, z, to screen one column:
zs = [20, 30, 40, 50, 60, 70]
for z in zs:
ys = df.query('column1==z')['Column2']
verts.append(list(zip(xs, ys)))