-
Notifications
You must be signed in to change notification settings - Fork 123
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
[Enh]: ncs.datetime selector #1813
Comments
Hey @davidhopkinson26 thanks for requesting this feature. This might be a duplicate of #1313, but it should be possible to make a dedicated datetime selector which is not built through |
Thanks for pointing out the similar ticket @FBruzzesi. Yes I am asking for a replication of pl.selectors.datetime functionality into narwhals rather than using by_dtype driectly. https://docs.pola.rs/api/python/stable/reference/selectors.html#polars.selectors.datetime #1313 appears to be about unexpected behaviour in by_dtype when passing datetime types. So that probably needs addressing first since a dedicated selector would presumably wrap by_dtype? |
thanks @davidhopkinson26 for your report as of #1869, it should be possible to use |
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?
use case for this came up in this PR of tubular azukds/tubular#366.
Please describe the purpose of the new feature or describe the problem to solve.
We want to select all datetime columns and currently have to define all of these:
TIME_UNITS = ["us", "ns", "ms"]
TIME_ZONES = zoneinfo.available_timezones().union({None})
DATETIME_VARIANTS = [
nw.Datetime(time_unit=time_unit, time_zone=time_zone)
for time_unit in TIME_UNITS
for time_zone in TIME_ZONES
]
datetime_columns = list(
X.select(ncs.by_dtype(*DATETIME_VARIANTS)).columns,)
Suggest a solution if possible.
I expect similar logic could be turned into an ncs.datetime selector function similar to current categorical/numeric.
If you have tried alternatives, please describe them below.
No response
Additional information that may help us understand your needs.
No response
The text was updated successfully, but these errors were encountered: