Example #1
0
    def max_dataframe(self, dataframes: hint.dataframes) -> hint.dataframes:
        """
        Generate a max dataframe for all of the data

        Args:
            dataframes: the dataframes we will use

        Returns:
            dataframes of all the max data
        """

        print('    {} Getting max data'.format(datetime.datetime.now()))

        maxs = {}
        for table_name in self.table_names:
            data_list = []
            for data in dataframes.values():
                data_list.append(data[table_name])

            concat     = pd.concat(data_list)
            row_concat = concat.groupby(concat.index)
            max_data   = row_concat.max()
            max_data['index'] = range(len(max_data.index))

            maxs[table_name] = max_data

        return maxs
Example #2
0
    def std_dataframe(self, dataframes: hint.dataframes) -> hint.dataframes:
        """
        Generate a std dataframe for all of the data

        Args:
            dataframes: the dataframes we will use

        Returns:
            dataframes of all the std data
        """

        print('    {} Getting standard deviation data'.
              format(datetime.datetime.now()))

        stds = {}
        for table_name in self.table_names:
            data_list = []
            for data in dataframes.values():
                data_list.append(data[table_name])

            concat     = pd.concat(data_list)
            row_concat = concat.groupby(concat.index)
            std_data   = row_concat.std()
            std_data['index'] = range(len(std_data.index))

            stds[table_name] = std_data

        return stds
Example #3
0
    def q_upper_dataframe(self, dataframes: hint.dataframes) -> hint.dataframes:
        """
        Generate a q_upper dataframe for all of the data

        Args:
            dataframes: the dataframes we will use

        Returns:
            dataframes of all the q_upper data
        """

        print('    {} Getting upper quantile data'.
              format(datetime.datetime.now()))

        q_uppers = {}
        for table_name in self.table_names:
            data_list = []
            for data in dataframes.values():
                data_list.append(data[table_name])

            concat       = pd.concat(data_list)
            row_concat   = concat.groupby(concat.index)
            q_upper_data = row_concat.quantile(97.5)
            q_upper_data['index'] = range(len(q_upper_data.index))

            q_uppers[table_name] = q_upper_data

        return q_uppers
    def create_prop(self, dataframes: hint.dataframes) -> None:
        """
        Add the resistant prop to all the dataframes

        Args:
            dataframes: the dataframes to use

        Effects:
            adds proportion columns
        """

        for dataframe in dataframes.values():
            self.add_resistant_prop(dataframe)