rapidsai / cudf

cuDF - GPU DataFrame Library
https://docs.rapids.ai/api/cudf/stable/
Apache License 2.0
8.33k stars 888 forks source link

[FEA] pandas DatetimeIndex.indexer_between_time #15380

Open raybellwaves opened 6 months ago

raybellwaves commented 6 months ago

I watched @shwina's GTC talk (https://register.nvidia.com/flow/nvidia/gtcs24/attendeeportaldigital/page/sessioncatalog/session/1695219773174001AmnA thanks Ashwin I really enjoyed it!)

Is your feature request related to a problem? Please describe. No. I just noticed there wasn't an issue for DatetimeIndex.indexer_between_time. I also enjoyed the user experience that %%cudf.pandas.profile points users to raise issues to highlight pandas API that falls back to CPU (https://github.com/rapidsai/cudf/blob/branch-24.06/python/cudf/cudf/pandas/profiler.py#L300).

Describe the solution you'd like

import pandas as pd
pd.date_range("2023-01-01", "2023-01-02", freq="1h").indexer_between_time("09:00", "16:00")
import cudf
cudf.date_range("2023-01-01", "2023-01-02", freq="1h").indexer_between_time("09:00", "16:00")

Describe alternatives you've considered There may be a cudf work around in the meantime for a user who needs indexer_between_time that could be captured at https://docs.rapids.ai/api/cudf/stable/cudf_pandas/

Additional context Could create a new issue template with the "pandas" label (https://github.com/rapidsai/cudf/issues?q=is%3Aopen+is%3Aissue+label%3Apandas) to be used at https://github.com/rapidsai/cudf/blob/branch-24.06/python/cudf/cudf/pandas/profiler.py#L297 fixed a bug at https://github.com/rapidsai/cudf/pull/15381

shwina commented 6 months ago

Thanks, @raybellwaves!

I think this could be implemented in terms of the existing datetime methods. For instance, idx.indexer_between_time('09:00', '17:00') would be 9 <= idx.dt.hour < 17 - unless I'm missing something.

This would make a great contribution if you (or anyone else) is interested in taking it on!

srinivasyadav18 commented 6 months ago

Hi @shwina, I would like to take up on this issue if no one has started working on this.

shwina commented 6 months ago

Fantastic! No one has yet so please feel free to take it on. Don't hesitate to reach out to us either here or on the RAPIDS slack if you have any questions!

er-eis commented 5 months ago

@srinivasyadav18, still working on this?

srinivasyadav18 commented 5 months ago

@er-eis Yes, I have been trying it for few days, but could not make much progress. Please feel free to work on it!

er-eis commented 5 months ago

sounds good, i'll take this then!