मराठी

Using the myarray4 created in the above questions, write commands for the following: a) Find the sum of all elements. b) Find the sum of all elements row wise.

Advertisements
Advertisements

प्रश्न

Using the myarray4 created in the above questions, write commands for the following:

  1. Find the sum of all elements.
  2. Find the sum of all elements row wise.
  3. Find the sum of all elements column wise
  4. Find the max of all elements.
  5. Find the min of all elements in each row.
  6. Find the mean of all elements in each row.
  7. 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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: Introduction to NumPy - Exercise [पृष्ठ ११४]

APPEARS IN

एनसीईआरटी Informatics Practices [English] Class 11
पाठ 6 Introduction to NumPy
Exercise | Q 10. | पृष्ठ ११४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×