1

Refer to the question mentioned on this link In Python how will you multiply individual elements of a list with a floating point or integer number?

I use import numpy as np; then multiply a list with a flaoting number and stored the updated values in the same list. However, the new values are like [[array([ 10.])] .....

Now I want to remove array and use the list with the integer value.

Community
  • 1
  • 1
user228839
  • 33
  • 1
  • 5

1 Answers1

1

you want to turn the np.array() back to a list?

import numpy as np
P=2.45
S=[22, 33, 45.6, 21.6, 51.8]
SP = P*np.array(S)
SP_LIST =list(SP)

As the post you link to also contains:

[x * P for x in S]

returns a list directly

JAB
  • 12,401
  • 6
  • 45
  • 50