I have a 40,000 by 60 Numpy array and I want it like this:
mat[:,[0:13,19:23,23:31,39:59]]
Obviously this won't work. Is there a smarter way to do this than concatenation?
Use np.r_ -
np.r_
mat[:,np.r_[0:13,19:23,23:31,39:59]]
Example run -
In [48]: mat = np.random.rand(100,1000) In [50]: mat[:,np.r_[0:13,19:23,23:31,39:59]].shape Out[50]: (100, 45) In [51]: 13+4+8+20 Out[51]: 45