#๐Ÿ”’ Strange Numpy deprecation error

5 messages ยท Page 1 of 1 (latest)

zinc river
#

Hi guys, I've wrote a code to solve an optimization problem (long long code) a while ago (1 and half years) and now I decided to use it again but some weird warning popped up:

/var/folders/jr/2rw78jp90ygcq5vy168_l29w0000gn/T/ipykernel_75922/3476840333.py:126: 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.)
  coeff[i,0] = x_[5*i]
/var/folders/jr/2rw78jp90ygcq5vy168_l29w0000gn/T/ipykernel_75922/3476840333.py:127: 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.)
  coeff[i,1] = x_[5*i + 1]
/var/folders/jr/2rw78jp90ygcq5vy168_l29w0000gn/T/ipykernel_75922/3476840333.py:128: 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.)
  coeff[i,2] = x_[5*i + 2]
/var/folders/jr/2rw78jp90ygcq5vy168_l29w0000gn/T/ipykernel_75922/3476840333.py:129: 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.)
  coeff[i,3] = x_[5*i + 3]

Does anybody have any idea about what might this be and what should I change ? I could post the entire code but it is really really long so if I can get some hints from there I'd appreciate it a lot.
Thanks

rocky spokeBOT
#

@zinc river

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

subtle ridge
#

How long is the code? Is there any chance you can share it?

rocky spokeBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.