Mean
(np.mean())
: Calculates the arithmetic mean (average) of elements along a specified axis in an array. It computes the sum of all elements and divides it by the number of elements.Median
(np.median())
: Computes the median, which is the middle value of a sorted array. If the array has an odd number of elements, the median is the middle value. If it has an even number, it’s the average of the two middle values.Standard Deviation
(np.std())
: Calculates the standard deviation, which measures the spread of data around the mean. It’s the square root of the variance, where variance is the average of the squared differences from the mean.Sort
(np.sort())
: Sorts the elements of an array along a specified axis. By default, it sorts the array in ascending order along the last axis. You can specify the axis along which to sort and whether to return a sorted copy or sort the array in place.
Numpy Exercise¶
Introduction to Numpy¶
NumPy is a Python library that provides support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays efficiently. It is widely used in scientific computing, data analysis, and machine learning due to its powerful array manipulation capabilities and efficient numerical operations.
Numpy functions¶
See the code below to understand how these functions work.
Match the NumPy function with its description:
Try numpy functions in the Python REPL below:
Instructions¶
SHIFT + ENTER
on the code cell below to see the quiz. Match the NumPy functions with their descriptions and click on the “Submit” button to check your answers.