0% found this document useful (0 votes)
34 views

NumPy Functions Cheatsheet

Uploaded by

anupygzp0805
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

NumPy Functions Cheatsheet

Uploaded by

anupygzp0805
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

allinpython.

com Save This Post


@allinpython For Future

np.array(): Create a NumPy array from


#1
a Python list or tuple.

np.zeros(): Create an array filled


#2
with zeros of a specified shape.

np.ones(): Create an array filled with


#3
ones of a specified shape.

np.arange(): Create an array with


#4
values within a specified range.

np.linspace(): Create an array with


#5
evenly spaced values over a specified
interval.
allinpython.com Save This Post
@allinpython For Future

np.reshape(): Reshape an array into a


#6
new shape.

np.random.rand(): The rand() function


#7
is used to generate an array with
random values between 0 to 1.

np.random.randn(): Generate an array


#8
of random numbers from a standard
normal distribution. (close to zero)

np.random.randint(): Generate an array


#9
of random integers within a specified
range.

np.mean(): Calculate the mean of array


#10
elements.

np.median(): Calculate the median of


#11
array elements.
allinpython.com Save This Post
@allinpython For Future

np.std(): Calculate the standard


#12
deviation of array elements.

np.sum(): Compute the sum of array


#13
elements.

np.min(), np.max(): Find the minimum


#14
and maximum values in an array.

np.argmin(), np.argmax(): Find the


#15
indices of the minimum and maximum
values in an array.

np.dot(): Compute the dot product of


#16
two arrays.

np.transpose(): Calculate transpose


#17
of the array.

np.concatenate(): Concatenate arrays


#18
along a specified axis.
allinpython.com Save This Post
@allinpython For Future

np.split(): Split an array into


#19
multiple sub-arrays.

np.vstack(), np.hstack(): Stack arrays


#20
vertically and horizontally.

np.unique(): Find the unique elements


#21
in an array.

np.save(), np.load(): Save and load


#22
arrays to/from disk.

np.clip(): Clip (limit) the values in


#23
an array.

np.where(): Return elements chosen


#24
from two arrays based on a condition.

np.linalg.inv(): Calculate inverse of


#25
the matrix.
allinpython.com Save This Post
@allinpython For Future

np.linalg.det(): Calculate determinant


#26
of the matrix.

np.linalg.solve(): Solve a system of


#27
linear equations.

np.percentile(): Compute the nth


#28
percentile of the data.

np.corrcoef(): Compute the correlation


#29
coefficient between two arrays.

np.deg2rad(), np.rad2deg(): Convert


#30
angles from degrees to radians and
vice versa.

np.argsort(): Return the indices that


#31
would sort an array.

np.searchsorted(): Find indices where


#32
elements should be inserted to
maintain order.
allinpython.com Save This Post
@allinpython For Future

np.arcsin(), np.arccos(), np.arctan():


#33
Inverse trigonometric functions.

np.linalg.eig(): Eigenvalues and


#34
eigenvectors of a square matrix.

np.linalg.svd(): Singular value


#35
decomposition.

For more Notes and Ebooks visit our

allinpython

You might also like