Array a has shape (3, 4). What is the shape of a.mean(axis=1)?
-
A
(3,)
Correct answer
-
B
(4,)
-
C
(3, 4)
-
D
(1,)
18 views
Explanation
axis=1 averages across columns within each row, collapsing that axis and leaving one mean per row: shape (3,). Add keepdims=True to keep (3, 1).
Reference
Asked in: Data Science Interviews
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ