Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

find the index of nanmax

def nanargmax(a):
    idx = np.argmax(a, axis=None)
    multi_idx = np.unravel_index(idx, a.shape)
    if np.isnan(a[multi_idx]):
        nan_count = np.sum(np.isnan(a))
        # In numpy < 1.8 use idx = np.argsort(a, axis=None)[-nan_count-1]
        idx = np.argpartition(a, -nan_count-1, axis=None)[-nan_count-1]
        multi_idx = np.unravel_index(idx, a.shape)
    return multi_idx

>>> nanargmax(a)
Comment

PREVIOUS NEXT
Code Example
Python :: Django-rest-framework-simplejwt.readthedocs.io 
Python :: tweepy to dataframe 
Python :: djangorestframework install command 
Python :: giving activation in dense layer keras 
Python :: python first letter to capitalize 
Python :: python long multiline text 
Python :: python created nested directory 
Python :: Dizideki en son elemani alma 
Python :: list of ones python 
Python :: upper method in python 
Python :: how to read file again in python 
Python :: linux echo redirect output to python script 
Python :: 56.5 to 57 in python 
Python :: is dictreader scoped in python 
Python :: torch.cuda.randn 
Python :: python - columns that contain the lengh of a string 
Python :: fibonacci 10th 
Python :: tkinter lottery app 
Python :: numpy symmetrize array 
Python :: mutliple inxed conditions py 
Python :: python insert text in string before certain symbol 
Python :: Python Creating a Tuple 
Python :: what does math.acos do in python 
Python :: Convert Time object to String in python 
Python :: jittering(adding back rounded up values) 
Python :: heksadesimal ke ascii 
Python :: python get stringvar value 
Python :: Extracting the cluster labels from a dendrogram 
Python :: python flask rest api upload image 
Python :: base64 encode image in python 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =