in fclib/fclib/feature_engineering/feature_utils.py [0:0]
def normalized_current_date(datetime_col, min_date, max_date):
"""
Temporal feature indicating the position of the date of a record in the
entire time period under consideration, normalized to be between 0 and 1.
Args:
datetime_col: Datetime column.
min_date: minimum value of date.
max_date: maximum value of date.
Returns:
float: the position of the current date in the min_date:max_date range
"""
date = datetime_col # .dt.date
current_date = (date - min_date) # .apply(lambda x: x.days)
if max_date != min_date:
current_date = current_date / (max_date - min_date) # .days
else:
current_date = pd.Series([0 for x in range(len(datetime_col))])
return current_date