Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Finding the maximum element from a matrix with Python numpy.argmax()

import numpy as np    

a = np.matrix([[1,2,3,33],[4,5,6,66],[7,8,9,99]])

print(np.argmax(a))  # 11, which is the position of 99
print(np.argmax(a[:,:]))  # 11, which is the position of 99
print(np.argmax(a[:1]))  # 3, which is the position of 33
print(np.argmax(a[:,2]))  # 2, which is the position of 9
print(np.argmax(a[1:,2]))  # 1, which is the position of 9
Comment

PREVIOUS NEXT
Code Example
Python :: insert multiple column pandas 
Python :: do i need do some set when i use GPU to train tensorflow model 
Python :: how to make a calcukatir in python 
Python :: change version of python that poetry use 
Python :: circular linked list in python 
Python :: selenium python get image from url 
Python :: casefold in python 
Python :: calendar module in python 
Python :: how split text in python by space or newline with regex 
Python :: use chrome console in selenium 
Python :: stringindexer pyspark 
Python :: python for print 
Python :: print statements 
Python :: pathlib change extension 
Python :: Python NumPy tile Function Syntax 
Python :: how to convert .py into .exe through pytohn scripts 
Python :: flask_jinja structure 
Python :: how to remove .0 from string column with empty strings in python 
Python :: comment faire pour retourner une liste python 
Python :: [1,2,3,4,5] 
Python :: Parallel Tasks python 
Python :: planet earth minecraft 
Python :: How to install proxy pool in scrapy? 
Python :: how to use group by in python to get 15 mins candle data from 1 min candle 
Python :: python converter to c 
Shell :: error: cannot install "code": classic confinement requires snaps under /snap or 
Shell :: how to install cv2 
Shell :: git change username email 
Shell :: uninstall wps office ubuntu 
Shell :: remove docker container 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =