import itertools as IT
groupby = IT.groupby

def using_groupby(a):
    return [list(v) for k, v in groupby(a, np.isfinite) if k]
numpy: split 1D array of chunks separated by nans into a list of the chunks