2021年3月18日星期四

Iterating numpy arrays and formatting into multi dimensional arrays

I am trying code a numpy function where it organizes the Appending_list function below to a multi dimensional array for each iteration of Values. So in the first iteration is Number_array + 0 for the first row and the second row is Number_array + 1 and the third is Number_array + 2.

import numpy as np  from numpy import random  Values = np.arange(0,3,1)  Number_array =  np.arange(1,5,1)  Appending_list = Number_array + Values * len(Number_array)  

Expected Output

[[1,2,3,4], [2,3,4,5], [3,4,5,6]]  
https://stackoverflow.com/questions/66701237/iterating-numpy-arrays-and-formatting-into-multi-dimensional-arrays March 19, 2021 at 09:05AM

没有评论:

发表评论