I have numpy array with the shape of (1212,2117).
The array contains pixels with value 0 or values that are rgeater than 0 , looks like this:

I want to give the 0 pixels value of no data. I have tried to do it this way:
arr=arr.astype('float')
arr[arr==0]=np.nan
It seems like the result is chart that is all NaN.with one little square:
plt.imshow(test)
However it seems like all the values were changes, as if I check what is the max or min value of this array I get nan:
test.max()
>>>nan
test.min()
>>>nan
I would like to understand why I get this result and how can I correctly give no data values for pixels with value of 0.
