I have an array of floats whose size is not known in advance. There are zero values in it and other floats. I want to replace its zeroes with a certain value only for part of the array, let's say for the first third of the array, with another value for the second third, and another value for the last third.
I was trying to use my_array[:my_array.size//3:] = first_value as suggested here as part of a list comprehension:
my_array = np.asarray([first_value for x in my_array[:my_array.size//3:] if x == 0])
but this reduces the array to only its first third. How can I replace the zeroes in the way described above?