0

Data Science: Pandas Pandas Pandas: my code works in 4/5 testcases. In the 3. one doesn't. What did I miss?

n = int(input()) X=[] clu1=[] clu2=[] for i in range(n): X.append(input().split()) import numpy as np c1 = np.array([0, 0]) c2 = np.array([2, 2]) X_array=np.array(X) X_arrayf=X_array.astype(np.float) for i in X_arrayf: d1=np.sqrt(((c1-i)**2).sum()) d2=np.sqrt(((c2-i)**2).sum()) if d1<=d2: clu1.append(i) else: clu2.append(i) clum1=np.array(clu1) clum2=np.array(clu2) import pandas as pd m1=clum1.mean(axis=0) m2=clum2.mean(axis=0) if clu1==[] or clu2==[]: print('None') else: print(m1.round(2)) print(m2.round(2))

24th Mar 2021, 11:13 AM
Dalma Hajek-Simonyi
2 ответов
0
Now I see. Thanks a lot. :)
24th Mar 2021, 4:27 PM
Dalma Hajek-Simonyi