def convert_column ( self , values ) : assert all ( values >= 0 ) , 'Cannot normalize a column with negatives' total = sum ( values ) if total > 0 : return values / total else : return values
function that "standardizes" a column python
Normalize values .
def convert_column(self, values):
        """Normalize values."""
        assert all(values >= 0), 'Cannot normalize a column with negatives'
        total = sum(values)
        if total > 0:
            return values / total
        else:
            return values