I have a given array with a length of over 1'000'000
and values between 0
and 255
(included) as integers. Now I would like to plot on the x-axis the integers from 0
to 255
and on the y-axis the quantity of the corresponding x value in the given array (called Arr
in my current code).
I thought about this code:
list = []
for i in range(0, 256):
icounter = 0
for x in range(len(Arr)):
if Arr[x] == i:
icounter += 1
list.append(icounter)
But is there any way I can do this a little bit faster (it takes me several minutes at the moment)? I thought about an import ...
, but wasn't able to find a good package for this.