First of all, this is cheating as you did not at all replicate the behavior of the other script, you just changed the algorithm completely .
A suggestion to change how you are doing things was the point, yes.
More importantly, processing everything unconditionally is not even close to an acceptable solution in my use case
So if you look closely, you will see that the compute_all_stats is a generator, which means it evaluates lazily. The filter_stats kind of presumed that everything could be collected in one big pass. But it could be a generator too (it would need to keep around and build up an appropriate data structure for incremental filtering). The point is to tease things apart into more, smaller, discrete, testable chunks, which can certainly be done, even if you require lazy (generator) evaluation. I would not keep things in a single loop has you have, under any circumstances, because that tangled business logic is unmaintainable.
You seem really obsessed with replicating control flow when all that really matters is that results match, and satisfy any other requirements (e.g. being able to stream process incrementally instead of one batch). To be honest, this whole thread seems like another example of the x-y problem: