MCPcopy Create free account
hub / github.com/ScottfreeLLC/AlphaPy / pchange2

Function pchange2

alphapy/transforms.py:1070–1089  ·  view source on GitHub ↗

r"""Calculate the percentage change between two variables. Parameters ---------- f : pandas.DataFrame Dataframe containing the two columns ``c1`` and ``c2``. c1 : str Name of the first column in the dataframe ``f``. c2 : str Name of the second column in t

(f, c1, c2)

Source from the content-addressed store, hash-verified

1068#
1069
1070def pchange2(f, c1, c2):
1071 r"""Calculate the percentage change between two variables.
1072
1073 Parameters
1074 ----------
1075 f : pandas.DataFrame
1076 Dataframe containing the two columns ``c1`` and ``c2``.
1077 c1 : str
1078 Name of the first column in the dataframe ``f``.
1079 c2 : str
1080 Name of the second column in the dataframe ``f``.
1081
1082 Returns
1083 -------
1084 new_column : pandas.Series (float)
1085 The array containing the new feature.
1086
1087 """
1088 new_column = f[c1] / f[c2] - 1.0
1089 return new_column
1090
1091
1092#

Callers 1

gapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected