0

I am trying to alter the values in an array. I, first created an array from a previous array by setting a condtion. The previous array was called Sales_Salary and the new array is called index which was made by using where(Sales_Salary<200000). Now, I want to update index by multiplying the values by 1.2.

Here is my code:

index = np.where(Sales_Salary<20000)
print(Sales_Salary[index])

How do I do this? Any hints?

Thanks

mozway
  • 194,879
  • 13
  • 39
  • 75
Jon
  • 43
  • 5
  • 1
    What you ask is probably answered here https://stackoverflow.com/questions/35166633/how-do-i-multiply-each-element-in-a-list-by-a-number – Apostolis Kasselouris Oct 24 '21 at 15:56
  • @ApostolisKasselouris Thanks for that post. I did not realise that all I had to do was to multiply Sales_Salary[index]*1.2. – Jon Oct 24 '21 at 15:58
  • @Pythonlearner Yes, it has. It seems that I forgot that you could do it directly. – Jon Oct 24 '21 at 16:18

0 Answers0