You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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 nw.selectors.by_dtype
#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?
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 lvgig/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: