Answer the question
In order to leave comments, you need to log in
How to put a numpy array into a numpy array?
I have such a task:
I need to transfer a one-dimensional array with numbers to the class, and the class must create as many arrays in one numpy array as there are elements and the one-dimensional one that we passed, and with the dimension of each passed element. Example:
class Net():
def __init__(self, input_list):
self.output = np.full((len(input_list),2),0.0)#массив в который нужно сложить другие массивы
for i in range(len(input_list)):
self.output.функция_добовления_массива_в_массив(input_list[i],2)#здесь добовляем массив в массив и исользуем размерность переданую в каждом из элементов input_list
def ret(self):
return self.output#функция возврата полученного массива с массивами
input_list = [20,80,10,10,20,6]
MyNet = Net(input_list)
output = MyNet.ret()
Answer the question
In order to leave comments, you need to log in
np.array([np.zeros((i, 2), dtype=np.float32) for i in input_list])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question