market_variables.py 文件源码

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

项目:AlphaPy 作者: ScottFreeLLC 项目源码 文件源码
def diff(f, c, n = 1):
    r"""Calculate the n-th order difference for the given variable.

    Parameters
    ----------
    f : pandas.DataFrame
        Dataframe containing the column ``c``.
    c : str
        Name of the column in the dataframe ``f``.
    n : int
        The number of times that the values are differenced.

    Returns
    -------
    new_column : pandas.Series (float)
        The array containing the new feature.

    """
    new_column = np.diff(f[c], n)
    return new_column


#
# Function down
#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号