import numpy as np
x = np.random.randint(0, 10, 40)
print("Original array:")
print(x)
print("Most frequent value in the above array:")
print(np.bincount(x).argmax())
Sample Output:
Original array:
[4 7 3 8 4 8 6 3 1 8 6 3 3 9 7 8 3 3 0 6 8 3 1 8 2 2 9 7 8 9 8 5 9 6 8
5 3
8 9 1]
Most frequent value in the above array:
8
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer