I have a variable of type <class 'numpy.ndarray'>.It is 2dim Array Python
Q = [[0.5 0.5 ] [0.99876063 0.99876063]]
My question is how to extract 0.998 and 0.998 from the last row and save them into 2 different variables ?
CodePudding user response:
Try this,
a, b = Q[1][0], Q[1][1]
CodePudding user response:
import numpy as np
Q = np.array([[0.5,0.5 ],[0.99876063,0.99876063]])
v1,v2 = Q[1][0],Q[1][1]
print(v1,v2)
This should work
CodePudding user response:
you can try this
x, y = Q[-1][0],Q[-1][1]