问题 The task I wish to accomplish is the following: Consider a 1-D array a and an array of indices parts of length N . Example: a = np.arange(9) parts = np.array([4, 6, 9]) # a = array([0, 1, 2, 3, 4, 5, 6, 7, 8]) I want to cast a into a 2-D array of shape (N, <length of longest partition in parts>) , inserting values of a upto each index in indx in each row of the 2-D array, filling the remaining part of the row with zeroes, like so: array([[0, 1, 2, 3], [4, 5, 0, 0], [6, 7, 8, 0]) I do not wish