0

I have numpy array loaded from csv like this:

array[['Blue', '1.1', '123', 'One'],
   ['Black', '5.7', '20', 'Two'],
   ['White', '2.0', '50', 'Three'],
   ['White', '0.3', '105', 'One']]

What I wanna do is to sort it alphabetically (1st cloumn) to be like this:

array[['Black', '5.7', '20', 'Two'],
   ['Blue', '1.1', '123', 'One'],
   ['White', '2.0', '50', 'Three'],
   ['White', '0.3', '105', 'One']]

And by keyword at 4th column:

array[['Blue', '1.1', '123', 'One'],
   ['White', '0.3', '105', 'One'],
   ['Black', '5.7', '20', 'Two'],
   ['White', '2.0', '50', 'Three']]

Is it even possible? np.sort() sorts it just fine but it shuffles all the values and sorts every single column independently.

Vasyl Butov
  • 454
  • 1
  • 4
  • 19

0 Answers0