Check numpy version before defining np.in1d, Simplify indptr calculation