month_delta return incorrect value if passed a date object #84
Open
Description
I am attempting to replicate the functionality of relativedelta. The month_delta meets my current purposes but it return incorrect values if passed a date object.
This provided incorrect results. I would expect correct values or a ValueError
df_ = df.filter(pl.col("date") <= end_date).with_columns(
yr_for_calc=xdt.month_delta(pl.col("date"), end_date) / 12
)
The following was my workaround:
df_ = (
df.filter(pl.col("date") <= end_date)
.with_columns(end_date=end_date)
.with_columns(
yr_for_calc=xdt.month_delta(pl.col("date"), pl.col("end_date")) / 12
)
).drop("end_date")