Неожиданно произойдет следующее:
# in a loop
.
try:
pressure_book[element] = c @ np.matrix([1] + point).T
except TypeError as e:
print(c, type(c), d.type)
print(point, type(point))
raise e
.
.
И выводит:
[[-1.52088384e+08 5.39161089e+03 9.08576658e+03 -3.23303777e-01]] <class 'numpy.matrixlib.defmatrix.matrix'> float64
[26088.6210156483, 17551.050000000003, 457882691.876694] <class 'list'>
Traceback (most recent call last):
File "C:/Users/evkouni/Desktop/PythonGIT/trials.py", line 111, in <module>
raise e
File "C:/Users/evkouni/Desktop/PythonGIT/trials.py", line 106, in <module>
pressure_book[element] = c @ np.matrix([1] + point).T
TypeError: Object arrays are not currently supported
Однако, когда я пробую значения в консоли, все работает нормально.
>>> c = np.matrix([[-1.52088384e+08, 5.39161089e+03, 9.08576658e+03, -3.23303777e-01]])
>>> point = [26088.6210156483, 17551.050000000003, 457882691.876694]
>>> c @ np.matrix([1] + point).T
matrix([[849.00029883]])
Любые идеи, что может быть причиной этого?
РЕДАКТИРОВАТЬ: кажется, np.matrix([1] + point).dtype
возвращает object
после пары итераций float64
В случае, если это уместно, я запускаю это, используя Python 3.5, numpy 1.15.4 из PyCharm 2018.3