+ 1

How to unflatten this array into 2x3?

[ 1, 2, 3, 4, 5, 6 ]

21st May 2020, 3:56 PM
Lerninn
5 odpowiedzi
+ 7
# use .reshape method for that: import numpy as np t = np.array([1,2,3,4,5,6]) print(t.reshape(2,3)) https://www.sololearn.com/learn/6678/?ref=app
21st May 2020, 4:02 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
.reshape does not change the actual array, just returns the reshaped copy, while .resize permanently changes its dimensions.
21st May 2020, 4:10 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Kuba Siekierzyński Nice!! thanks.
21st May 2020, 4:03 PM
Lerninn
+ 1
Kuba Siekierzyński what is the difference between .reshape and .resize?
21st May 2020, 4:07 PM
Lerninn
+ 1
It is quite simple to know about all the inbuilt functions of an module or even if any particular function of that module . Use the following syntex to get the information about that . import numpy as np print (help(np.resize))
21st May 2020, 4:29 PM
Ayush Kumar
Ayush Kumar - avatar