mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-09-16 22:20:23 +00:00
Replace deprecated pandas .ix
This commit is contained in:
parent
e4ec600da4
commit
047a0c3c23
1 changed files with 9 additions and 7 deletions
|
|
@ -296,7 +296,9 @@ class Prophet(object):
|
||||||
.round()
|
.round()
|
||||||
.astype(np.int)
|
.astype(np.int)
|
||||||
)
|
)
|
||||||
self.changepoints = self.history.ix[cp_indexes]['ds'].tail(-1)
|
self.changepoints = (
|
||||||
|
self.history.iloc[cp_indexes]['ds'].tail(-1)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# set empty changepoints
|
# set empty changepoints
|
||||||
self.changepoints = []
|
self.changepoints = []
|
||||||
|
|
@ -615,9 +617,9 @@ class Prophet(object):
|
||||||
function.
|
function.
|
||||||
"""
|
"""
|
||||||
i0, i1 = df['ds'].idxmin(), df['ds'].idxmax()
|
i0, i1 = df['ds'].idxmin(), df['ds'].idxmax()
|
||||||
T = df['t'].ix[i1] - df['t'].ix[i0]
|
T = df['t'].iloc[i1] - df['t'].iloc[i0]
|
||||||
k = (df['y_scaled'].ix[i1] - df['y_scaled'].ix[i0]) / T
|
k = (df['y_scaled'].iloc[i1] - df['y_scaled'].iloc[i0]) / T
|
||||||
m = df['y_scaled'].ix[i0] - k * df['t'].ix[i0]
|
m = df['y_scaled'].iloc[i0] - k * df['t'].iloc[i0]
|
||||||
return (k, m)
|
return (k, m)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
@ -639,11 +641,11 @@ class Prophet(object):
|
||||||
function.
|
function.
|
||||||
"""
|
"""
|
||||||
i0, i1 = df['ds'].idxmin(), df['ds'].idxmax()
|
i0, i1 = df['ds'].idxmin(), df['ds'].idxmax()
|
||||||
T = df['t'].ix[i1] - df['t'].ix[i0]
|
T = df['t'].iloc[i1] - df['t'].iloc[i0]
|
||||||
|
|
||||||
# Force valid values, in case y > cap.
|
# Force valid values, in case y > cap.
|
||||||
r0 = max(1.01, df['cap_scaled'].ix[i0] / df['y_scaled'].ix[i0])
|
r0 = max(1.01, df['cap_scaled'].iloc[i0] / df['y_scaled'].iloc[i0])
|
||||||
r1 = max(1.01, df['cap_scaled'].ix[i1] / df['y_scaled'].ix[i1])
|
r1 = max(1.01, df['cap_scaled'].iloc[i1] / df['y_scaled'].iloc[i1])
|
||||||
|
|
||||||
if abs(r0 - r1) <= 0.01:
|
if abs(r0 - r1) <= 0.01:
|
||||||
r0 = 1.05 * r0
|
r0 = 1.05 * r0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue