Advertisements
Advertisements
प्रश्न
Using the myarray4 created in the above questions, write commands for the following:
- Find the sum of all elements.
- Find the sum of all elements row wise.
- Find the sum of all elements column wise
- Find the max of all elements.
- Find the min of all elements in each row.
- Find the mean of all elements in each row.
- Find the standard deviation column wise.
कोड लेखन
Advertisements
उत्तर
a) print(np.sum(myarray4))
Output:
115.5
b) print(np.sum(myarray4, axis=1))
Output:
[-2.25 0. 2.25 4.5 6.75 9. 11.25 13.5 15.75 18. 20.25 22.5 24.75 27. ]
c) print(np.sum(myarray4, axis=0))
Output:
[54.25 57.75 61.25]
d) print(np.max(myarray4))
Output:
9.25
e) print(np.min(myarray4, axis=1))
Output:
[-1. -0.25 0.5 1.25 2. 2.75 3.5 4.25 5. 5.75 6.5 7.25 8. 8.75]
f) print(np.mean(myarray4, axis=1))
Output:
[-0.75 0. 0.75 1.5 2.25 3. 3.75 4.5 5.25 6. 6.75 7.5 8.25 9. ]
g) print(np.std(myarray4, axis=0))
Output:
[3.02334688 3.02334688 3.02334688]
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
