r"""Calculate the net change of a given column. Parameters ---------- f : pandas.DataFrame Dataframe containing the column ``c``. c : str Name of the column in the dataframe ``f``. o : int, optional Offset value for shifting the series. Returns -
(f, c='close', o = 1)
| 973 | # |
| 974 | |
| 975 | def net(f, c='close', o = 1): |
| 976 | r"""Calculate the net change of a given column. |
| 977 | |
| 978 | Parameters |
| 979 | ---------- |
| 980 | f : pandas.DataFrame |
| 981 | Dataframe containing the column ``c``. |
| 982 | c : str |
| 983 | Name of the column in the dataframe ``f``. |
| 984 | o : int, optional |
| 985 | Offset value for shifting the series. |
| 986 | |
| 987 | Returns |
| 988 | ------- |
| 989 | new_column : pandas.Series (float) |
| 990 | The array containing the new feature. |
| 991 | |
| 992 | References |
| 993 | ---------- |
| 994 | *Net change is the difference between the closing price of a security |
| 995 | on the day's trading and the previous day's closing price. Net change |
| 996 | can be positive or negative and is quoted in terms of dollars* [IP_NET]_. |
| 997 | |
| 998 | .. [IP_NET] http://www.investopedia.com/terms/n/netchange.asp |
| 999 | |
| 1000 | """ |
| 1001 | new_column = f[c] - f[c].shift(o) |
| 1002 | return new_column |
| 1003 | |
| 1004 | |
| 1005 | # |