# Path: simplestatistics/statistics/mean.py
# def mean(data):
#     """
#     The mean_, or *average*, is "the sum of values divided by the number of values".
# 
#     .. _mean: https://en.wikipedia.org/wiki/Mean
# 
#     Equation:
#         .. math::
#             \\bar{X} = \\frac{\\sum X}{n}
# 
#     Args:
#         data: A numeric built-in object, a tuple,
#             or list of numeric objects.
# 
#     Returns:
#         A float object.
# 
#     Examples:
# 
#         >>> mean([1])
#         1.0
#         >>> mean([1, 2])
#         1.5
#         >>> mean([1, 2, 3])
#         2.0
#         >>> mean([-1, 0, 1, 2, 3])
#         1.0
#     """
#     data = decimalize(copy.deepcopy(data)) # don't modify the original data
#     return float(sum(data) / len(data))
# 
# Path: simplestatistics/statistics/decimalize.py
# def decimalize(data):
#     """
#     Utility function converting all inputs to Decimal,
#     streamlines input types for other statistics functions.
# 
#     Args:
#         data: A numeric built-in object, a tuple or list of numeric objects.
# 
#     Returns:
#         A Decimal object in the case of a single numeric built-in, or a list of
#         Decimal objects when supplied a list or tuple of built-in numerics.
# 
#     Raises:
#         TypeError: An object other than a built-in numeric or a list or tuple
#         of numerics was supplied as data.
# 
#     Examples:
# 
#         >>> decimalize(1)
#         Decimal('1')
#         >>> decimalize([1,2,3])
#         [Decimal('1'), Decimal('2'), Decimal('3')]
#         >>> decimalize((1,2,3))
#         [Decimal('1'), Decimal('2'), Decimal('3')]
# 
#         >>> decimalize('abc')
#         Sorry, the decimalize function accepts lists or tuples of numerics
#     """
#     try:
#         if type(data) in [int, float]:
#             return(decimal.Decimal(data))
#         elif type(data) == list:
#             for ii, _ in enumerate(data):
#                 data[ii] = decimal.Decimal(data[ii])
#             return data
#         elif type(data) == tuple:
#             data = list(data)
#             for ii, _ in enumerate(data):
#                 data[ii] = decimal.Decimal(data[ii])
#             return data
#         else:
#             raise TypeError
#     except TypeError:
#         print("Sorry, the decimalize function accepts lists or tuples of numerics")
#     return
# 
# Path: simplestatistics/statistics/standard_deviation.py
# def standard_deviation(data, sample=True):
#     """
#     The `standard deviation`_ is the square root of variance_ (the sum of squared deviations
#     from the mean).
#     The standard deviation is a commonly used measure of the variation and distance of
#     a set of values in a sample from the mean of the sample.
# 
#     .. _`standard deviation`: https://en.wikipedia.org/wiki/Standard_deviation
#     .. _variance: http://en.wikipedia.org/wiki/Variance
# 
#     Equation:
# 
#         .. math::
#             \\sigma = \\sqrt{\\frac{\\sum (x - \\mu)^2}{N - 1}}
# 
#         In English:
#             - Obtain the difference between each value and the mean.
#             - Square those values.
#             - Sum the squared values.
#             - Divide by the number of values - 1 (to correct for the sampling).
#             - Obtain the square root of the result.
# 
#     Args:
#         data: A list of numerical objects.
#         sample: A boolean value. If True, calculates standard deviation for
#           sample. If False, calculates standard deviation for population.
# 
#     Returns:
#         A float object.
# 
#     Examples:
# 
#         >>> standard_deviation([1, 2, 3])
#         1.0
#         >>> standard_deviation([1, 2, 3], False)
#         0.816496580927726
#         >>> standard_deviation([1, 2, 3, 4])
#         1.2909944487358056
#         >>> standard_deviation([-1, 0, 1, 2, 3, 4])
#         1.8708286933869707
#     """
#     return math.sqrt(variance(data, sample))


from .mean import mean
from .decimalize import decimalize
from .standard_deviation import standard_deviation

    Args:
        data: A list of numerical objects.
        sample: A boolean value. If True, calculates z scores for
          sample. If False, calculates z scores for population.

    Returns:
        A list of float objects.

    Examples:
        >>> z_scores([-2, -1, 0, 1, 2])
        [1.2649110640673518, 0.6324555320336759, 0.0, -0.6324555320336759, -1.2649110640673518]
        >>> z_scores([-2, -1, 0, 1, 2], False)
        [1.414213562373095, 0.7071067811865475, 0.0, -0.7071067811865475, -1.414213562373095]
        >>> z_scores([1, 2])
        [0.7071067811865475, -0.7071067811865475]
        >>> z_scores([1, 2], False)
        [1.0, -1.0]
        >>> z_scores([90]) # a z score for one value is not defined
        >>> z_scores(4) # a z score for one value is not defined
    """
    # You can't get z scores for one number
    if type(data) is int:
        return(None)
    elif type(data) is list:
        # You can't get z scores for one number
        if len(data) < 2:
            return(None)

        mean_of_data = decimalize(mean(data))

# Path: simplestatistics/statistics/mean.py
# def mean(data):
#     """
#     The mean_, or *average*, is "the sum of values divided by the number of values".
# 
#     .. _mean: https://en.wikipedia.org/wiki/Mean
# 
#     Equation:
#         .. math::
#             \\bar{X} = \\frac{\\sum X}{n}
# 
#     Args:
#         data: A numeric built-in object, a tuple,
#             or list of numeric objects.
# 
#     Returns:
#         A float object.
# 
#     Examples:
# 
#         >>> mean([1])
#         1.0
#         >>> mean([1, 2])
#         1.5
#         >>> mean([1, 2, 3])
#         2.0
#         >>> mean([-1, 0, 1, 2, 3])
#         1.0
#     """
#     data = decimalize(copy.deepcopy(data)) # don't modify the original data
#     return float(sum(data) / len(data))
# 
# Path: simplestatistics/statistics/decimalize.py
# def decimalize(data):
#     """
#     Utility function converting all inputs to Decimal,
#     streamlines input types for other statistics functions.
# 
#     Args:
#         data: A numeric built-in object, a tuple or list of numeric objects.
# 
#     Returns:
#         A Decimal object in the case of a single numeric built-in, or a list of
#         Decimal objects when supplied a list or tuple of built-in numerics.
# 
#     Raises:
#         TypeError: An object other than a built-in numeric or a list or tuple
#         of numerics was supplied as data.
# 
#     Examples:
# 
#         >>> decimalize(1)
#         Decimal('1')
#         >>> decimalize([1,2,3])
#         [Decimal('1'), Decimal('2'), Decimal('3')]
#         >>> decimalize((1,2,3))
#         [Decimal('1'), Decimal('2'), Decimal('3')]
# 
#         >>> decimalize('abc')
#         Sorry, the decimalize function accepts lists or tuples of numerics
#     """
#     try:
#         if type(data) in [int, float]:
#             return(decimal.Decimal(data))
#         elif type(data) == list:
#             for ii, _ in enumerate(data):
#                 data[ii] = decimal.Decimal(data[ii])
#             return data
#         elif type(data) == tuple:
#             data = list(data)
#             for ii, _ in enumerate(data):
#                 data[ii] = decimal.Decimal(data[ii])
#             return data
#         else:
#             raise TypeError
#     except TypeError:
#         print("Sorry, the decimalize function accepts lists or tuples of numerics")
#     return
# 
# Path: simplestatistics/statistics/standard_deviation.py
# def standard_deviation(data, sample=True):
#     """
#     The `standard deviation`_ is the square root of variance_ (the sum of squared deviations
#     from the mean).
#     The standard deviation is a commonly used measure of the variation and distance of
#     a set of values in a sample from the mean of the sample.
# 
#     .. _`standard deviation`: https://en.wikipedia.org/wiki/Standard_deviation
#     .. _variance: http://en.wikipedia.org/wiki/Variance
# 
#     Equation:
# 
#         .. math::
#             \\sigma = \\sqrt{\\frac{\\sum (x - \\mu)^2}{N - 1}}
# 
#         In English:
#             - Obtain the difference between each value and the mean.
#             - Square those values.
#             - Sum the squared values.
#             - Divide by the number of values - 1 (to correct for the sampling).
#             - Obtain the square root of the result.
# 
#     Args:
#         data: A list of numerical objects.
#         sample: A boolean value. If True, calculates standard deviation for
#           sample. If False, calculates standard deviation for population.
# 
#     Returns:
#         A float object.
# 
#     Examples:
# 
#         >>> standard_deviation([1, 2, 3])
#         1.0
#         >>> standard_deviation([1, 2, 3], False)
#         0.816496580927726
#         >>> standard_deviation([1, 2, 3, 4])
#         1.2909944487358056
#         >>> standard_deviation([-1, 0, 1, 2, 3, 4])
#         1.8708286933869707
#     """
#     return math.sqrt(variance(data, sample))


# Path: simplestatistics/statistics/z_scores.py
from .mean import mean
from .decimalize import decimalize
from .standard_deviation import standard_deviation


    Args:
        data: A list of numerical objects.
        sample: A boolean value. If True, calculates z scores for
          sample. If False, calculates z scores for population.

    Returns:
        A list of float objects.

    Examples:
        >>> z_scores([-2, -1, 0, 1, 2])
        [1.2649110640673518, 0.6324555320336759, 0.0, -0.6324555320336759, -1.2649110640673518]
        >>> z_scores([-2, -1, 0, 1, 2], False)
        [1.414213562373095, 0.7071067811865475, 0.0, -0.7071067811865475, -1.414213562373095]
        >>> z_scores([1, 2])
        [0.7071067811865475, -0.7071067811865475]
        >>> z_scores([1, 2], False)
        [1.0, -1.0]
        >>> z_scores([90]) # a z score for one value is not defined
        >>> z_scores(4) # a z score for one value is not defined
    """
    # You can't get z scores for one number
    if type(data) is int:
        return(None)
    elif type(data) is list:
        # You can't get z scores for one number
        if len(data) < 2:
            return(None)

        mean_of_data = decimalize(mean(data))

        sd_of_data = decimalize(standard_deviation(data, sample))