I am trying to generate the output of the following Python statement with simple-enough-to-understand steps, possibly using for-loops. I have studied the .reshape method and what -1 means as a dimension. Here is a simplified code snippet:
import numpy as np
x = np.arange(6)in
y = x**2
#-my attempt-/uncomment to see reosults-
#X =[[0, 0]]
#for i in np.araznge(1, 6):
# X.append([[x[i],y[i]]])
#print(X)
#
#----------------------------
points = np.array([x, y]).T.reshape(-1, 1, 2)
print (points)
"""
# The output of the original statement,
# which I would like to emulate is:
[[[ 0 0 ]]
[[ 1 1 ]]
[[ 2 4 ]]
[[ 3 9 ]]
[[ 4 16]]
[[ 5 25]]]
"""