def ml_regression_build_prediction_test_window(self, req, num_units, rds, dbs):
import pandas as pd
ml_type = req["MLType"]
target_column_name = req["TargetColumnName"] # What column is getting processed?
target_column_values = req["TargetColumnValues"] # Possible values each int in the target_column_name maps to
train_feature_names = req["TrainFeatures"] # Pass in the features to train
source_df = req["SourceDF"]
sample_filter_mask = (source_df["DSName"] != "")
new_df = source_df.iloc[-1 * int(num_units):]
if "Date" in str(source_df.columns):
new_df["Date"] = pd.to_datetime(new_df["Date"], format='%Y-%m-%d') # assuming the Date column is present
if "FDate" in str(source_df.columns):
new_df["FDate"] = pd.to_datetime(new_df["FDate"], format='%Y-%m-%d') # assuming the Future Date column is present
last_row = new_df.iloc[-1]
return new_df
# end of ml_regression_build_prediction_test_window
评论列表
文章目录