INNER CODE UNIT · Python
last_date
ScottfreeLLC/AlphaPy · alphapy/analysis.py:220
last_date = df.index[-1]
logger.info("Analyzing %s from %s to %s", tag, first_date, last_date)
# sequence leaders, laggards, and target(s)
df = sequence_frame(df, target, forecast_period, leaders, lag_period)
# get frame subsets
if predict_mode:
new_predict = df.loc[(df.index >= split_date) & (df.index <= last_date)]
if len(new_predict) > 0:
predict_frame = predict_frame.append(new_predict)
else:
logger.info("Prediction frame %s has zero rows. Check prediction date.",
tag)
else:
# split data into train and test
new_train = df.loc[(df.index >= train_date) & (df.index < predict_date)]
if len(new_train) > 0:
new_train = new_train.dropna()
train_frame = train_frame.append(new_train)