Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from pandas import DataFrame
- inp1 = [{'a':1, 'b':2, 'c':0}, {'a':1,'b':3,'c':0}, {'a':0,'b':3,'c':0}]
- df1 = DataFrame(inp1)
- inp2 = [{'d':2, 'e':0}, {'d':0,'e':3}, {'d':0,'e':4}]
- df2 = DataFrame(inp2)
- threshold = 1
- df1.loc[np.sqrt((df1.a - df2.d) ** 2 + (df1.b - df2.e) ** 2) > threshold, 'c'] = "yes"
- print(df1)
- print(df2)
- a b c
- 0 1 2 yes
- 1 1 3 0
- 2 0 3 0
- d e
- 0 2 0
- 1 0 3
- 2 0 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement