Saturday, February 10, 2024

Numpy Library Functions

 

FunctionDescription
np.array()Create an array.
np.zeros()Create an array filled with zeros.
np.ones()Create an array filled with ones.
np.arange()Return evenly spaced values within a given interval.
np.linspace()Return evenly spaced numbers over a specified interval.
np.random.rand()Generate random numbers from a uniform distribution.
np.random.randn()Generate random numbers from a normal (Gaussian) distribution.
np.min()Return the minimum value along a given axis.
np.max()Return the maximum value along a given axis.
np.sum()Return the sum of array elements over a given axis.
np.mean()Compute the arithmetic mean along a specified axis.
np.median()Compute the median along a specified axis.
np.std()Compute the standard deviation along a specified axis.
np.dot()Compute the dot product of two arrays.
np.transpose()Reverse or permute the axes of an array.
np.reshape()Give a new shape to an array without changing its data.
np.concatenate()Join a sequence of arrays along an existing axis.
np.split()Split an array into multiple sub-arrays.
np.unique()Find the unique elements of an array.
np.argsort()Return the indices that would sort an array.
np.argmax()Return the indices of the maximum values along an axis.
np.argmin()Return the indices of the minimum values along an axis.
np.where()Return elements chosen from x or y depending on condition.
np.clip()Clip (limit) the values in an array.
np.isnan()Test element-wise for NaN (Not a Number).
np.isinf()Test element-wise for positive or negative infinity.
np.all()Test whether all array elements along a given axis evaluate to True.
np.any()Test whether any array element along a given axis evaluates to True.
np.save()Save an array to a binary file in NumPy .npy format.
np.load()Load an array from a binary file saved with np.save().

These are just a few of the many functions available in the NumPy library, which is widely used for numerical computing in Python.

No comments:

Post a Comment

Input Text and Display in tkinter

  import tkinter as tk def display_text():     text = entry.get()     label.config(text="You entered: " + text) root = tk.Tk() roo...