from numpy import NaN as nan
import numpy as np
a = np.array([nan, nan, 1, 2, 3, nan, nan, 10, 11, nan, nan, nan, 23, 1,
    nan, 7, 8])
from itertools import groupby
result = [list(v) for k, v in groupby(a, np.isfinite) if k]
print(result)
numpy: split 1D array of chunks separated by nans into a list of the chunks