I have a list of stock prices of a company. Now I want to split the list with multiple intervals. we will store the price like: The first 2 elements, then next 3 elements, then 2 elements, and so on.
meta_stocks = [10, 9, 11, 15, 19, 22, 25, 11, 15, 17]
Output
meta_stocks = [[10, 9],[11, 15, 19],[22, 25],[ 11, 15, 17]]
I am able to split the list with 5 items each but not able to split it further
>>> [meta_stocks[i:i+interval2] for i in range(0, len(meta_stocks), interval2)]
>>> [[10, 9, 11, 15, 19], [22, 25, 11, 15, 17]]