[Numpy-discussion] How to preserve number of array dimensions when taking a slice?
Dr. Phillip M. Feldman
pfeldman@verizon....
Fri Aug 7 23:53:16 CDT 2009
I'd like to be able to make a slice of a 3-dimensional array, doing something
like the following:
Y= X[A, B, C]
where A, B, and C are lists of indices. This works, but has an unexpected
side-effect. When A, B, or C is a length-1 list, Y has fewer dimensions than
X. Is there a way to do the slice such that the number of dimensions is
preserved, i.e., I'd like Y to be a 3-dimensional array, even if one or more
dimensions is unity. Is there a way to do this?
--
View this message in context: http://www.nabble.com/How-to-preserve-number-of-array-dimensions-when-taking-a-slice--tp24875133p24875133.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the NumPy-Discussion
mailing list