How to speed up the for-loop with dataframe access

To understand @bkamins brief comments above, I found another one from him, which provides the details.