Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable floordiv on durations: duration // duration #19908

Open
rhshadrach-8451 opened this issue Nov 21, 2024 · 0 comments
Open

Enable floordiv on durations: duration // duration #19908

rhshadrach-8451 opened this issue Nov 21, 2024 · 0 comments
Labels
enhancement New feature or an improvement of an existing feature

Comments

@rhshadrach-8451
Copy link

Description

Python allows

import datetime as dt

print(dt.timedelta(hours=1, minutes=30) // dt.timedelta(minutes=35))
# 2

This seems to me to be well-defined and useful. Polars gives

df = pl.DataFrame({"a": dt.timedelta(hours=1, minutes=30)})
df.with_columns(b=pl.col("a") // pl.duration(minutes=35))
# InvalidOperationError: floor_div not allowed on duration[μs] and duration[μs]

#12330 has a list of allowed arithmetic operations in the OP and duration // duration is not mentioned there, but it is also not discussed in that issue. cc @Wainberg

Somewhat similar issues (but also don't discuss duration // duration):

@rhshadrach-8451 rhshadrach-8451 added the enhancement New feature or an improvement of an existing feature label Nov 21, 2024
@rhshadrach-8451 rhshadrach-8451 changed the title Enable floor_div on duration // duration Enable floor_div on durations: duration // duration Nov 21, 2024
@rhshadrach-8451 rhshadrach-8451 changed the title Enable floor_div on durations: duration // duration Enable floordiv on durations: duration // duration Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant