I have numpy arrays of start indices and end ind开发者_开发问答ices from which I'd like to construct a flattened array of ranges.
e.g. with inputs
s = np.array([1,2,3])
e = np.array([4,5,10])
and output
array([1,2,3,2,3,4,3,4,5,6,7,8,9])
any way to do this efficiently?
How about just
np.concatenate([np.arange(x, y) for x, y in zip(s, e)])
精彩评论