This might give you some ideas, though I'm sure it's not 100% correct for your specific use case because the code you posted is sort of unclear. But you should be able to adapt this to your needs.
result = []
for ii, term in enumerate(idf):
result.append(0)
for tf in tf_ar[6*ii:6*(ii+1)]:
result[-1] += term * tf
The key idea is to "enumerate" to get an integer index to go along with the iteration over idf
, then make "slices" with [x:y] of tf_ar
which are 6 wide each.