idea of timedelta based algorithm
This commit is contained in:
parent
e8f3a7aea8
commit
da594fb5ba
@ -259,6 +259,12 @@ def _process_sales(
|
|||||||
|
|
||||||
min_date = dates.min()
|
min_date = dates.min()
|
||||||
|
|
||||||
|
stride = dopt_basics.datetime.timedelta_from_val(365, TimeUnitsTimedelta.DAYS)
|
||||||
|
|
||||||
|
dates = cast(pd.DatetimeIndex, monthly_sum.index)
|
||||||
|
|
||||||
|
min_date = dates.min()
|
||||||
|
|
||||||
# print("dates: ", dates)
|
# print("dates: ", dates)
|
||||||
# ?? --- new: use monthly basis for time windows
|
# ?? --- new: use monthly basis for time windows
|
||||||
# baseline: 3 years - 36 months
|
# baseline: 3 years - 36 months
|
||||||
@ -268,12 +274,12 @@ def _process_sales(
|
|||||||
# (i for i, date in enumerate(dates) if date >= starting_date), len(dates) - 1
|
# (i for i, date in enumerate(dates) if date >= starting_date), len(dates) - 1
|
||||||
# )
|
# )
|
||||||
# print("start idx: ", start_index, "length dates: ", len(dates))
|
# print("start idx: ", start_index, "length dates: ", len(dates))
|
||||||
# starting_date = datetime.datetime.now() - relativedelta(months=36)
|
starting_date = datetime.datetime.now() - relativedelta(months=12)
|
||||||
starting_date = dates.max() - relativedelta(months=36)
|
# starting_date = dates.max() - relativedelta(months=36)
|
||||||
start_index = next(
|
# start_index = next(
|
||||||
(i for i, date in enumerate(dates) if date >= starting_date), len(dates) - 1
|
# (i for i, date in enumerate(dates) if date >= starting_date), len(dates) - 1
|
||||||
)
|
# )
|
||||||
print("start idx: ", start_index, "length dates: ", len(dates))
|
# print("start idx: ", start_index, "length dates: ", len(dates))
|
||||||
|
|
||||||
def get_index_date(
|
def get_index_date(
|
||||||
dates: pd.DatetimeIndex,
|
dates: pd.DatetimeIndex,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user