Answers for "python np array"

0

python numpy array

import numpy as np

ary=np.array([1, 2, 3, 4])

print(ary[0]) # 1
print(ary[2]) # 3
print(ary[::2]) # array([1, 3])
Posted by: Guest on October-08-2021
0

np.array

x = np.array([ [67, 63, 87],
               [77, 69, 59],
               [85, 87, 99], # Creates an array, with arrays 
               [79, 72, 71],
               [63, 89, 93],
               [68, 92, 78]])
               
# its shape is [6,3] | 6 beeing its "height" and 3 its "width"

# if you want to to get this inffo about this array you can search for it 
#just like you were searching for itens in an array, like:

fatness_of_the_array-x = x.shape[1] # 1 is refering to the width commented earlier
Posted by: Guest on September-09-2021

Browse Popular Code Answers by Language