Primer On Numpy Arrays
1. CREATING NUMPY ARRAY
# import numpy as np
import numpy as np 1.1. From the Pythonβs List
# first, create a list from 'list' function
list1 = list(range(1,10))
print("This is the list")
print(list1)
# second, create array from the list
print("\nThis is the Numpy array created from above list")
print(np.array(list1)) a. Upcasting
b. Explicitly setting the dtype
1.2. From Ranged Data
a. Single number is passed in the argument
b. Two numbers passed in the argument
c. Three numbers are passed in the arguments
1.3. From Linspace function
1.4. Special Functions
1.5. From Random Numbers
a. np.random.random
b. np.random.randint
c. np.random.normal
2. RESHAPING THE ARRAY
2.1. np.reshape
2.2. np.reshape with -1
2.3. flatten method
2.4. Transpose
a. Simple Transpose
b. Transpose with axes kwarg
3. ARRAY ATTRIBUTES
4. OTHER BASICS
Last updated