I have a 2D numpy array. Some of the values in this array are NaN. I want to perform certain operations using this array. For example consider the array:
For your purposes, if all the items are stored as str and you just use sorted as you are using and then check for the first element and replace it with '0'
>>> l1 = ['88','NaN','67','89','81']
>>> n = sorted(l1,reverse=True)
['NaN', '89', '88', '81', '67']
>>> import math
>>> if math.isnan(float(n[0])):
... n[0] = '0'
...
>>> n
['0', '89', '88', '81', '67']