I think that pandas probably allows what I want to do in a clever way that will avoid a loop, but I do not know how to structure it.
pandas