I'm trying to set elemnts of array1 to nan based on elements of array2 which are nan.
The following is my code (which isn't working)
I would greatly appreciate assistance :)
array1 = np.array([1.,1.,1.,1.,1.,1.,1.,1.,1.,1.])
array2 = np.array([2.,2.,2.,2.,np.nan,np.nan,np.nan,2.,2.,2.])
#I want to create:
#[1.,1.,1.,1.,np.nan,np.nan,np.nan,1.,1.,1.]
# I've tried:
array1[array2 == np.nan] = np.nan
print(array1)
[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]