The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() in if loop

Viewed 30

I am struggling with this error. This is a part of my code:

for k, v in d.items():
for x,y in zip(df3['0'],df3['1']):
    for u,w in zip(v['0'],v['1']):
        distance= haversine_np(x,y,u,v)
        if distance < 0.03:
            print(x,u,y,v,distance)

I am checking the distance between co-ordinates from 1 data frame and co-ordinates of other data frame. For every co-ordinate in my target data frame I am checking the distance between all the co-ordinates of other data frame.

Error image

I am new to python. Excuse if the question is too silly. Thanks in advance.

0 Answers
Related