INNER CODE UNIT · Python

apply

HHammond/PrettyPandas · prettypandas/summarizer.py:53

    def apply(self, df):
        """Compute aggregate over DataFrame"""

        if self.subset:
            if _axis_is_rows(self.axis):
                df = df[self.subset]
            if _axis_is_cols(self.axis):
                df = df.loc[self.subset]

        result = df.agg(self.func, axis=self.axis, *self.args, **self.kwargs)
        result.name = self.title
        return result


class Formatter(object):
    """Formatter

    Wrapper to apply formatting to datafame.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…