<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ratio(self, col: str, ratio_col: str="Ratio"):
 """ Add a column whith the percentages ratio from a column :param col: column to calculate ratio from :type col: str :param ratio_col: new ratio column name, defaults to "Ratio" :param ratio_col: str, optional :example: ``ds2 = ds.ratio("Col 1")`` """

        try:
            df = self.df.copy()
            df[ratio_col] = df[[col]].apply(
                lambda x: 100 * x / float(x.sum()))
            self.df = df
        except Exception as e:
            self.err(e, self.ratio, "Can not calculate ratio")