How can I use numpy/scipy to flatten a nested list with sublists of different sizes? Speed is very important and the lists are large.
lst = [[1, 2, 3, 4],[2, 3],[1, 2, 3, 4, 5],[4, 1, 2]]
Is anything faster than this?
vec = sp.array(list(*chain(lst)))
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…