Playing with NumPy | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Playing with NumPy

https://code.sololearn.com/cfEGBBQKlJb4/?ref=app What is a[None]? Why it is [[1 2 3 4 5]]? Code: import numpy as np a = np.array(range(6)) print(a) print(a[None]) Output: [1 2 3 4 5] [[1 2 3 4 5]]

10th Dec 2018, 9:38 PM
portpass
2 Answers
0
It's so simple! a[None] is a[None, :, :]! But it seemed really strange and unclear last night, when I was sleeppy ;)
11th Dec 2018, 6:46 AM
portpass