Blog

python tutorials and learn python

Created with Sketch.

NumPy std()

NumPy std() Summary: in this tutorial, you’ll learn how to use the numpy std() function to calculate the standard deviation. Standard deviation measures how spread out the elements of an array is. The more spread out elements is, the greater their standard deviation. Standard deviation is the square root of the variance. To calculate the…
Read more

NumPy var()

NumPy var() Summary: in this tutorial, you’ll learn how to use the var() function to calculate the variances of elements in an array. Introduction to the NumPy var() function The variance is a measure of the spread of a distribution. To manually calculate the variance of numbers, you follow these steps: First, calculate the average…
Read more

NumPy mean()

NumPy mean() Summary: in this tutorial, you’ll learn how to use the numpy mean() function to calculate the average of elements of an array. Introduction to the NumPy mean() function The mean() function returns the average of elements in an array. Here’s the syntax of the mean() function: numpy.mean(a, axis=None, dtype=None, out=None, keepdims=<no value>, *,…
Read more

NumPy sum()

NumPy sum() Summary: in this tutorial, you’ll learn how to use the numpy sum() function to return the sum of all elements in an array. Introduction to the numpy sum() function The numpy sum() function is an aggregate function that takes an array and returns the sum of all elements. The following example uses the…
Read more

NumPy copy()

NumPy copy() Summary: in this tutorial, you’ll learn how to use the NumPy copy() method to create a copy of an array rather than a view. Introduction to the NumPy copy() method When you slice an array, you get a subarray. The subarray is a view of the original array. In other words, if you…
Read more

Boolean Indexing

Boolean Indexing Summary: in this tutorial, you’ll learn how to access elements of a numpy array using boolean indexing. Introduction to numpy array boolean indexing Numpy allows you to use an array of boolean values as an index of another array. Each element of the boolean array indicates whether or not to select the elements…
Read more

Fancy Indexing

Fancy Indexing Summary: in this tutorial, you’ll learn about the fancy indexing technique to select elements of a numpy array. Introduction to fancy indexing In the previous tutorial, you learned how to select elements from a numpy array using indexing and slicing techniques. Besides using indexing & slicing, NumPy provides you with a convenient way…
Read more

Numpy Array Slicing

Numpy Array Slicing Summary: in this tutorial, you’ll learn about the numpy array slicing that extracts one or more elements from a numpy array. Numpy array slicing on on-dimensional arrays NumPy arrays use brackets [] and : notations for slicing like lists. By using slices, you can select a range of elements in an array…
Read more

NumPy Array Indexing

NumPy Array Indexing Summary: in this tutorial, you’ll learn how to access elements of a numpy array using indices. Like a list, you can use the square bracket notation ([]) to access elements of a numpy array. NumPy array indexing on 1-D arrays Along a single axis, you can select elements using indices. The first…
Read more

NumPy linspace()

NumPy linspace() Summary: in this tutorial, you’ll learn how to use the numpy linspace() to create a new numpy array with evenly spaced numbers of a specified interval. Introduction to the numpy linspace() function The numpy linspace() function creates a new numpy array with evenly spaced numbers over a given interval: numpy.linspace(start, stop, num=50, endpoint=True,…
Read more