[solved] Data Science - Average of rows
Hey guys. I tried the Data Science Course and get stuck at the first Quiz/Task. Task Given a 2D array, return the rowmeans. Input Format First line: two integers separated by spaces, the first indicates the rows of matrix X (n) and the second indicates the columns of X (p) Next n lines: values of the row in X Output Format An numpy 1d array of values rounded to the second decimal. So i tried this but the hidden test cases 4 and 5 failed. Any idea whats wrong with my code? n, p = [int(x) for x in input().split()] #Werte aufnehmen spalte1=[] spalte2=[] for i in range(n): line=input().split() spalte1.append(float(line[0])) spalte2.append(float(line[1])) #numpy arrays erstellen import numpy as np nspalte1=np.array(spalte1) nspalte2=np.array(spalte2) nspalte1=nspalte1.reshape(-1,1) nspalte2=nspalte2.reshape(-1,1) #verbinden der arrays ganze_liste=np.concatenate((nspalte1,nspalte2),axis=1) #auswerten auswertung=ganze_liste.mean(axis =1) print(auswertung)