made anomaly calculation safer to pandas api changes