Summary of numpy functions I didn't know

$ python
>>> import numpy as np

maximum

>>> np.maximum([1,2], [3,1]) # array([3, 2])
>>> np.maximum(0, [-1, 2, -2, 4]) # array([0, 2, 0, 4])

argmax

>>> np.argmax([1,3,4,2]) # 2

max

>>> a = np.array([[1,4],[2,3]])
>>> np.max(a, axis=0) # array([2, 4])
>>> np.max(a, axis=1) # array([4, 3])

diagonal

>>> a = np.arange(9).reshape(3,3) # array([[0, 1, 2], [3, 4, 5], [6, 7, 8]])
>>> a.diagonal() # array([0, 4, 8])
>>> np.fliplr(a).diagonal() # array([2, 4, 6])

allclose

Find out if the matrices are approximately equal

Recommended Posts

Summary of numpy functions I didn't know
I didn't know the basics of Python
H29.2.27 ~ 3.5 Summary of what I did
Nowadays ... I didn't know Java was "compiled" twice! (> <)
I didn't know much about Linux environment variables
NumPy universal functions
I checked the processing speed of numpy one-dimensionalization
Summary of evaluation functions used in machine learning
I / O related summary of python and fortran
Add a list of numpy library functions little by little --a
A summary of what I have touched like a blog
Summary of how to share state with multiple functions
Numerical summary of data
Summary of Tensorflow / Keras
About all of numpy
Summary of pyenv usage
Summary of string operations
# 4 [python] Basics of functions
Summary of Python arguments
Summary of logrotate software logrotate
Set function of NumPy
Summary of test method
Add a list of numpy library functions little by little --- b
Add a list of numpy library functions little by little --c
[Python] Summary of how to use split and join functions
I want to judge the authenticity of the elements of numpy array
I didn't know how to use the [python] for statement
I wrote the basic operation of Numpy in Jupyter Lab.
I want to know the features of Python and pip
I want to know the legend of the IT technology world
Summary of activation functions (step, sigmoid, ReLU, softmax, identity function)
A list of functions that I came across with 100 Numpy knocks and thought "This is convenient!"