Python numpy sort 1D array

arrays, numpy, python, sorting

Solution

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

Problem

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?

Original source