0

Failed in test 3 of Pandas Pandas Pandas

I passed all the other tests except hidden question 3. I have no idea what is wrong with it?

28th Jan 2022, 3:35 PM
Andy Yeung
4 Answers
+ 1
Without to see your code cannot be helped.
28th Jan 2022, 3:43 PM
JaScript
JaScript - avatar
0
import pandas as pd import numpy as np n = int(input()) c1 = np.array([0,0]) c2 = np.array([2,2]) c1_arr = np.array([]).reshape(0,2) c2_arr = np.array([]).reshape(0,2) def dist(x,y): return np.sqrt(((x-y)**2).sum()) for i in range(n): x = np.array([[float(x) for x in input().split()]]) if dist(x,c1) <= dist(x,c2): c1_arr = np.concatenate((c1_arr, x), axis =0) else: c2_arr = np.concatenate((c2_arr, x), axis=0) print(np.round(np.mean(c1_arr, axis=0),2)) print(np.round(np.mean(c2_arr, axis=0),2))
29th Jan 2022, 12:34 AM
Andy Yeung
0
Can anyone help me please
29th Jan 2022, 12:36 AM
Andy Yeung
0
If the array is empty you need to print None, that's the trick for passing test 3
24th Aug 2022, 9:27 PM
Elias DS