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)
| 1068 | # |
| 1069 | |
| 1070 | def 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 | # |