Skip to content

month_delta return incorrect value if passed a date object #84

Open
@pounde

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")

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions