Код: Выделить всё
import numpy as np
for h in range(10):
try:
array = np.array([np.zeros((h, 4)), np.zeros((3, h))], dtype=object)
except ValueError:
print(f'Value Error for h={h} only.')
Полная ошибка в том,
Код: Выделить всё
File "path/to/arr.py", line 4, in
array = np.array([np.zeros((h, 4)), np.zeros((3, h))], dtype=object)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not broadcast input array from shape (3,4) into shape (3,)
Подробнее здесь: https://stackoverflow.com/questions/790 ... -a-certain