Instead use something like (stats["Useful Instructions"].sum() / stats["Useful Cycles"].sum())/ (self._stats_dict[ref_key].stats["Useful Instructions"].sum()/self._stats_dict[ref_key].stats["Useful Cycles"].sum())