def drop_missing(Y, X=None, axis=1):
 Y = np.asarray(Y)
 if (Y.ndim == 1):
  Y = Y[:, None]
 if (X is not None):
  X = np.array(X)
  if (X.ndim == 1):
   X = X[:, None]
  keepidx = np.logical_and((~ np.isnan(Y).any(axis)), (~ np.isnan(X).any(axis)))
  return (Y[keepidx], X[keepidx])
 else:
  keepidx = (~ np.isnan(Y).any(axis))
  return Y[keepidx]

def drop_missing ( Y , X = None , axis = 1 ) : Y = np . asarray ( Y ) if ( Y . ndim == 1 ) : Y = Y [ : , None ] if ( X is not None ) : X = np . array ( X ) if ( X . ndim == 1 ) : X = X [ : , None ] keepidx = np . logical_and ( ( ~ np . isnan ( Y ) . any ( axis ) ) , ( ~ np . isnan ( X ) . any ( axis ) ) ) return ( Y [ keepidx ] , X [ keepidx ] ) else : keepidx = ( ~ np . isnan ( Y ) . any ( axis ) ) return Y [ keepidx ]
returns views on the arrays y and x where missing observations are dropped .