@Vladimir F Героям слава's post solved my problem. However, it posts a warning as following:
DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
Haven't found a way to solve avoid this warning.