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
#
评论列表
文章目录