I'm looking for creating a random dimension numpy array, iterate and replace values per 10 for example.
I tried :
# Import numpy library
import numpy as np
def Iter_Replace(x):
print(x)
for i in range(x):
x[i] = 10
print(x)
def main():
x = np.array(([1,2,2], [1,4,3]))
Iter_Replace(x)
main()
But I'm getting this error :
TypeError: only integer scalar arrays can be converted to a scalar index
range(x)does not make sense ifxis array. What were you trying to do?