statistic_functions.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:jhTAlib 作者: joosthoeks 项目源码 文件源码
def HARMONIC_MEAN(df, n, price='Close'):
    """
    Harmonic mean of data
    """
    harmonic_mean_list = []
    i = 0
    while i < len(df[price]):
        if i + 1 < n:
            harmonic_mean = float('NaN')
        else:
            start = i + 1 - n
            end = i + 1
            harmonic_mean = statistics.harmonic_mean(df[price][start:end])
        harmonic_mean_list.append(harmonic_mean)
        i += 1
    return harmonic_mean_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号