I am trying to sort a numpy array using this very simple code:
print np.array([2,0,8,4,1]).sort()
However, I am getting the result:
None
Can someone tell me what's going on here?
The array probably gets sorted in-place, like Python's list.sort()
does so you don't get fooled into thinking the original array is still the same.
arr = np.array([2,0,8,4,1])
arr.sort()
print arr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With