+ 1
How to unflatten this array into 2x3?
[ 1, 2, 3, 4, 5, 6 ]
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
+ 2
.reshape does not change the actual array, just returns the reshaped copy, while .resize permanently changes its dimensions.
+ 1
Kuba Siekierzyński Nice!! thanks.
+ 1
Kuba Siekierzyński what is the difference between .reshape and .resize?
+ 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))