Pivots a dataframe

def pivot(self, index, **kwargs):
        """
        Pivots a dataframe
        """
        try:
            df = self._pivot(index, **kwargs)
            return pd.pivot_table(self.df, index=kwargs["index"],  **kwargs)
            """if df is None:
                self.err("Can not pivot table")
                return
            self.df = df"""
        except Exception as e:
            self.err(e, "Can not pivot dataframe")