Questions and discussion for this lecture live here. Fire away by hitting Reply below
FYI, I received this warning for this code being a future error (Lecture 26)
UG[i] = U[c]
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.)
UG[i] = U[c]
Thanks @Suurf
To fix this, we need to explicitly specify which element from U[c]
we want to assign to UG[i]
. Since there is only one item in U[c]
, we can simply call .item()
as follows:
UG[i] = U[c].item()
Thanks again,
Seán