I want to change the elements of array 2-D under the next condition: if the element> 100 change this element for the word "True" else change the element for the word: "False". I tried to do it but I couldn't. I share the next code that i did. I hope you can helpe me please.
import numpy as np
h1 =np.array([[10, 85, 103, 444, 150, 200, 35, 47],
[532, 476, 0, 1011, 50, 674, 5, 999],
[985, 7, 99, 101, 1, 58, 300, 78],
[750, 649, 86, 8, 505, 41, 745, 187]])
for r in range (0,len(h1)):
for c in range(0,len(h1[0])):
valor = h1[r][c]
if valor > 100:
h1[r][c] = 'True'
else:
h1[r][c] = 'False'
Theorically the out should be:
[[False, False, True, True, True, True, False, False],
[ True, True, False, True, False, True, False, True],
[ True, False, False, True, False, False, True, False],
[ True, True, False, False, True, False, True, True]]