[SciPy-User] NumPy array slicing: take all rows but several columns from the array

Martin Helm martin@mhelm...
Wed Jul 4 08:44:41 CDT 2012


Am 04.07.2012 15:37, schrieb Alexander Kalinin:
> import numpy as np
> A = np.zeros((10, 7))
> A[:, 0, 2, 5] = 1.0         # does not work
Use
A[:, [0, 2, 5]] = 1.0
as you do it you index a 4 dimensional array



More information about the SciPy-User mailing list