We would like to learn about your use case. For example, if this feature is needed to adopt Narwhals in an open source project, could you please enter the link to it below?
Thanks for the great library! We use narwhals at $WORK to write backend-agnostic code. One of our backends is Snowflake (via the Ibis backend).
Please describe the purpose of the new feature or describe the problem to solve.
Would it be possible to enable offsetting by other units (like month) in .dt.offset_by for the ibis backend? It appears that all of the pieces to support it are already there. For example, in the core function that does the interval
def timedelta_to_ibis_interval(td: timedelta) -> ibis.expr.types.temporal.IntervalScalar:
return ibis.interval(days=td.days, seconds=td.seconds, microseconds=td.microseconds)
it directly uses ibis.interval, which supports nanoseconds, microseconds, milliseconds, seconds, minutes, hours, days, weeks, months, quarters, and years. Would it just be a matter of relaxing this check (
|
if unit in {"y", "q", "mo", "d", "ns"}: |
)?
if unit in {"y", "q", "mo", "d", "ns"}:
msg = f"Offsetting by {unit} is not yet supported for ibis."
Suggest a solution if possible.
Relax the check
|
if unit in {"y", "q", "mo", "d", "ns"}: |
If you have tried alternatives, please describe them below.
Creating a custom .dt.offset_by function
Additional information that may help us understand your needs.
I would be willing to contribute this feature.
We would like to learn about your use case. For example, if this feature is needed to adopt Narwhals in an open source project, could you please enter the link to it below?
Thanks for the great library! We use narwhals at $WORK to write backend-agnostic code. One of our backends is Snowflake (via the Ibis backend).
Please describe the purpose of the new feature or describe the problem to solve.
Would it be possible to enable offsetting by other units (like month) in .dt.offset_by for the ibis backend? It appears that all of the pieces to support it are already there. For example, in the core function that does the interval
it directly uses ibis.interval, which supports nanoseconds, microseconds, milliseconds, seconds, minutes, hours, days, weeks, months, quarters, and years. Would it just be a matter of relaxing this check (
narwhals/src/narwhals/_ibis/expr_dt.py
Line 66 in 200baa7
Suggest a solution if possible.
Relax the check
narwhals/src/narwhals/_ibis/expr_dt.py
Line 66 in 200baa7
If you have tried alternatives, please describe them below.
Creating a custom .dt.offset_by function
Additional information that may help us understand your needs.
I would be willing to contribute this feature.