def interquartile_range_values(self):

        if len(self.__value) == 0:
            print("self.__value cannot be empty")
            return None

        for key in self.__value:
            if not isinstance(self.__value[key], (int, float)):
                print("all values of self.__value must be numbers")
                return None

        array = []
        for key in self.__value:
            array.append(self.__value[key])

        array.sort()

        if len(array) == 1:
            return array[0]

        lower_quartile = helper_functions.reusable_lower_quartile(array)
        upper_quartile = helper_functions.reusable_upper_quartile(array)

        interquartile_range = upper_quartile - lower_quartile

        return interquartile_range
Пример #2
0
    def get_interquartile_range(self):

        if len(self.__value) == 0:
            print("self.__value cannot be empty")
            return None

        self.__value.sort()

        lower_quartile = helper_functions.reusable_lower_quartile(self.__value)
        upper_quartile = helper_functions.reusable_upper_quartile(self.__value)

        interquartile_range = upper_quartile - lower_quartile

        return interquartile_range
    def lower_quartile_keys(self):

        if len(self.__value) == 0:
            print("self.__value cannot be empty")
            return None

        for key in self.__value:
            if not isinstance(key, (int, float)):
                print("all keys of self.__value must be numbers")
                return None

        array = []
        for key in self.__value:
            array.append(key)

        array.sort()

        if len(array) == 1:
            return array[0]

        lower_quartile = helper_functions.reusable_lower_quartile(array)

        return lower_quartile
    def lower_quartile_values_if_key(self, condition=" "):

        if len(self.__value) == 0:
            print("self.__value cannot be empty")
            return None

        for key in self.__value:
            if not isinstance(self.__value[key], (int, float)):
                print("all values of self.__value must be numbers")
                return None

        array = []
        for key in self.__value:
            if key == condition:
                array.append(self.__value[key])

        array.sort()

        if len(array) == 1:
            return array[0]

        lower_quartile = helper_functions.reusable_lower_quartile(array)

        return lower_quartile