Suppose I have np.array like below
dat = array([[ 0, 1, 0], [ 1, 0, 0], [0, 0, 1]] )
What I want to do is that adding the (index of row + 1) as a new column to this array, which is like
newdat = array([[ 0, 1, 0, 1], [ 1, 0, 0, 2], [0, 0, 1, 3]] )
How should I achieve this.
https://stackoverflow.com/questions/65745624/python-adding-index-as-new-column-to-2d-array January 16, 2021 at 09:25AM
没有评论:
发表评论