I am coming from IDL and trying to find and eliminate the NaNs in two lists of data. lets say there is a NaN in position 5 for list A but not list B. I need position 5 to be removed in both lists. Like so...
A = [1, NaN, 3, 4, NaN, 6, 7, 8, 9]
B = [1', 2', 3', NaN, 5', 6', 7', 8', NaN]
A_new = [1 , 3 , 6 , 7 , 8 ]
B_new = [1', 3', 6', 7', 8']
Here is the IDL code that works fine. I just need it translated to python and I am stumped.
;Removes the NANs
loc = where((Finite(pdcsapflux) EQ 1)and(Finite(time) EQ 1))
flux_nonan = pdcsapflux(loc)
time_nonan = time(loc)
Thanks!!