Data Science - Average of Rows [Code Coach]
Data Science - Average of Rows In a matrix, or 2-d array X, the averages (or means) of the elements of rows is called row means. 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. 2 2 1.5 1 2 2.9 Sample Output [1.25 2.45] _______________ My code: import numpy as np import pandas as pd n, p = [int(x) for x in input().split()] lst = [] for i in range(n): lst.append(input().split()) x = pd.DataFrame(lst).astype(float) y = x[:].sum(axis=1) / 2 y = np.array(y) print(y) the code successfully passes the first 3 test cases, but does not pass 4 and 5. The input data for 4 and 5 test cases is hidden. please help me understand what could be the matter