Note
Pandas (27) 본문
728x90
How to compute the euclidean distance between two series?
# Input
p = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
q = pd.Series([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])
# 1
sum((p - q)**2)**.5
# 2
np.linalg.norm(p-q)
# output
18.165902124584949
'Pandas' 카테고리의 다른 글
Pandas (29) (0) | 2022.08.21 |
---|---|
Pandas (28) (0) | 2022.08.20 |
Pandas (26) (0) | 2022.08.17 |
Pandas (25) (0) | 2022.08.16 |
Pandas (24) (0) | 2022.08.15 |
Comments