Data Science: Pandas Pandas Pandas: my code works in 4/5 testcases. In the 3. one doesn't. What did I miss? | Sololearn: Learn to code for FREE!

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))

3/24/2021 11:13:02 AM

Dalma Hajek-Simonyi

2 Answers

New Answer

+2

https://www.sololearn.com/Discuss/2713085/?ref=app https://www.sololearn.com/Discuss/2730223/?ref=app please use search bar

0

Now I see. Thanks a lot. :)