Update to average calculation for Github Issue #5202

This one needs a `copy=False` in the call to `astype` to avoid unnecessary copies.