def fill_gaps_generator(time_points, query, *columns):
 iterator = PeekableIterator(query)
 for t in time_points:
  row = iterator.peek()
  if (row and (row.date == t)):
   (yield (t, tuple((getattr(row, c) for c in columns))))
   iterator.next()
  else:
   (yield (t, tuple((0 for c in columns))))

def fill_gaps_generator ( time_points , query , * columns ) : iterator = PeekableIterator ( query ) for t in time_points : row = iterator . peek ( ) if ( row and ( row . date == t ) ) : ( yield ( t , tuple ( ( getattr ( row , c ) for c in columns ) ) ) ) iterator . next ( ) else : ( yield ( t , tuple ( ( 0 for c in columns ) ) ) )
generate a timeseries sequence with a value for every sample expected .