python类pvariance()的实例源码

statistic_functions.py 文件源码 项目:jhTAlib 作者: joosthoeks 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def PVARIANCE(df, n, price='Close', mu=None):
    """
    Population variance of data
    """
    pvariance_list = []
    i = 0
    while i < len(df[price]):
        if i + 1 < n:
            pvariance = float('NaN')
        else:
            start = i + 1 - n
            end = i + 1
            pvariance = statistics.pvariance(df[price][start:end], mu)
        pvariance_list.append(pvariance)
        i += 1
    return pvariance_list
QAAnalysis_dataframe.py 文件源码 项目:QUANTAXIS 作者: yutiansut 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def pvariance(self):
        return statistics.pvariance(self.price)

    # ??
learn_statistics.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def main():
    print(stats.mean(range(6)))
    print(stats.median(range(6)))
    print(stats.median_low(range(6)))
    print(stats.median_high(range(6)))
    print(stats.median_grouped(range(6)))
    try:
        print(stats.mode(range(6)))
    except Exception as e:
        print(e)
    print(stats.mode(list(range(6)) + [3]))
    print(stats.pstdev(list(range(6)) + [3]))
    print(stats.stdev(list(range(6)) + [3]))
    print(stats.pvariance(list(range(6)) + [3]))
    print(stats.variance(list(range(6)) + [3]))
test_statistics.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_compare_to_variance(self):
        # Test that stdev is, in fact, the square root of variance.
        data = [random.uniform(-17, 24) for _ in range(1000)]
        expected = math.sqrt(statistics.pvariance(data))
        self.assertEqual(self.func(data), expected)
test_statistics.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def test_compare_to_variance(self):
        # Test that stdev is, in fact, the square root of variance.
        data = [random.uniform(-17, 24) for _ in range(1000)]
        expected = math.sqrt(statistics.pvariance(data))
        self.assertEqual(self.func(data), expected)
stats.py 文件源码 项目:plumeria 作者: sk89q 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def pvariance(text):
    """
    Finds the population variance of a space-separated list of numbers.

    Example::

        /pvariance 33 54 43 65 43 62
    """
    return format_output(statistics.pvariance(parse_numeric_list(text)))
stats.py 文件源码 项目:plumeria 作者: sk89q 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setup():
    commands.add(mean)
    commands.add(median)
    commands.add(median_low)
    commands.add(median_high)
    commands.add(median_grouped)
    commands.add(mode)
    commands.add(pstdev)
    commands.add(pvariance)
    commands.add(stdev)
    commands.add(variance)


问题


面经


文章

微信
公众号

扫码关注公众号