Python Programming - Arrays - Discussion

Discussion Forum : Arrays - General Questions (Q.No. 83)
83.
Given a NumPy array arr = np.array([[1, 2], [3, 4]]), what does arr.sum(axis=1) calculate?
Sum of all elements in the array.
Sum of elements along the first axis.
Sum of elements along the second axis.
Sum of elements in each row.
Answer: Option
Explanation:
The sum() function with axis=1 calculates the sum of elements in each row.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.