Suppose I have 1x1x1x1x... array and wish to convert it to scalar?
How do I do it?
squeeze does not help.
squeeze
import numpy as np ma
You can index with the empty tuple after squeezing:
x = np.array([[[1]]]) s = np.squeeze(x) # or s = x.reshape(()) val = s[()] print val, type(val)