def get_in_batches(queryset, batch_size=10):
    start = 0
    if batch_size < 1:
        raise Exception("batch_size must be > 0")
    end = batch_size
    while True:
        batch = [x for x in queryset[start:end]]
        for y in batch:
            yield y
        if len(batch) < batch_size:
            break
        start += batch_size
        end += batch_size
Roll window worth of data up to position zero.
dataset/ETHPy150Open potatolondon/djangae/djangae/utils.py/get_in_batches--crossover with--dataset/ETHPy150Open quantopian/zipline/zipline/utils/data.py/MutableIndexRollingPanel._roll_data