[SciPy-User] How to select multiple columns at the same time?

Lutz Maibaum lutz.maibaum@gmail....
Mon Oct 25 23:02:05 CDT 2010


On Oct 25, 2010, at 8:46 PM, 22Nick22 Yanpei Liu wrote:
> Suppose A is an n * m matrix. I want to extract its first b columns just like Matlab command A(1:n, 1:b). What's the best way to do that? 

Try 

   A[:,:b]

Hope this helps,

  Lutz



More information about the SciPy-User mailing list