Use numpy arange method to create array with sequence of numbers.
In the below example we create an array of first 10 whole numbers.
Code to use Numpy Arange
# Imports
import numpy as np
# Let's build the array
np.arange(11)
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
That's how we use Numpy Arange
That’s all for this mini tutorial. To sum it up, we learned how to use numpy’s method “arange” to generate array of numbers.
Hope it was easy, cool and simple to follow. Now it’s on you.
Related Resources:
- Create array with Random numbers | Numpy tutorial Create array with Random Numbers Create array with Random Numbers with random module of Numpy library. In this Numpy tutorial...
- Create Vector in Python | Numpy Tutorial Create a Vector Create a Vector in Python using numpy array objects and reshape method. Vectors are backbone of math...
- Get value from index in Numpy array | Numpy tutorial Value from Index in Numpy Get value from index in numpy array using python like slicing. In below examples we...
- Reshape Numpy array | Numpy Tutorial Reshape Numpy Array Reshape numpy array with “reshape” method of numpy library. Reshaping numpy array is useful to convert array...
- Save Numpy array to csv file Save Numpy array to csv file Most machine learning engineers and Data Scientists use Numpy array because it’s efficient and...
- Convert an Array to one dimensional vector Convert an Array to One dimensional Vector | Flatten Convert an Array to One dimensional Vector with flatten method of...
- Diagonal of Square Matrix in Python | Numpy Tutorial Diagonal of Square Matrix Diagonal of Square Matrix can be fetched by diagonal method of numpy array. Diagonal of Square...
- Get Numpy array dimensions Find Numpy array dimensions Shape attribute of numpy can be used to find dimensions of numpy array easily. # Imports...
- Read csv file to numpy array Read csv file to numpy array Use “savetxt” method of numpy to save a numpy array to csv file Use...
- Reverse Numpy array | Various strategies Reverse Numpy arrays Reverse 1 dimensional numpy arrays using reverse slicing [ : :-1] Reverse N dimensional numpy arrays row wise using...