The current if then else assume that the data aligned and have same length:
def _if_then_else(x1, x2, x3):
"""if x1 is nonzero (keep NaN), then x2, else x3"""
return np.where(x1, x2, np.where(~np.isnan(x1), x3, np.nan))
However, with time series operator, the data usually don't have the same length
The current if then else assume that the data aligned and have same length:
def _if_then_else(x1, x2, x3):
"""if x1 is nonzero (keep NaN), then x2, else x3"""
return np.where(x1, x2, np.where(~np.isnan(x1), x3, np.nan))
However, with time series operator, the data usually don't have the same length