On Thu, 08 Jan 2015 09:56:50 -0800, Rustom Mody wrote: > Given a matrix I want to shift the 1st column 0 (ie leave as is) 2nd by > one place, 3rd by 2 places etc. > > This code works. > But I wonder if numpy can do it shorter and simpler.
def shiftcols(mat): iy,ix = np.indices(mat.shape) return mat[(iy+ix)%mat.shape[0],ix] -- https://mail.python.org/mailman/listinfo/python-list