1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
import numpy as np
zero_list = np.zeros(5, dtype = int) one_matrix = np.ones((2, 2), dtype = float) same_entry_matrix = np.full((1, 2), 2.333) mean = 0 sd = 1 normal_number_matrix = np.random.normal(mean, sd, (3, 3)) print(zero_list) print(one_matrix) print(same_entry_matrix) print(normal_number_matrix)
""" [0 0 0 0 0] [[1. 1.] [1. 1.]] [[2.333 2.333]] [[-0.16545138 -0.310813 -1.08602781] # 随机的 [ 1.99551174 0.19482657 -0.30166058] [ 0.60243205 -1.3135839 1.87655078]] """
start = 0 end = 10 step = 2 print(type(np.arange(start, end, step)) )
""" <class 'numpy.ndarray'> """
|
近期评论