I've seen the numpy deprecation message, "FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple" appear in various threads but don't see the most pythonic way to address it for my simple situation of a three-dimensional array:
import numpy as np
X=np.random.rand(3,4,5)
Y= np.vstack(X[:, :, x].T for x in range(1,3)) # vertically stack X[:,:,0], X[:,:,1], etc.
The resulting error message is
Warning (from warnings module): File "<pyshell#2>", line 1 FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.
Y= np.vstack([X[:, :, x].T for x in range(1,3)])Just as the waring saysarrays to stack must be passed as a "sequence" type such as list or tupleSo pass them as a list.