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

Implement Series.datetime.floor #9488

Merged
merged 29 commits into from
Oct 29, 2021

Conversation

skirui-source
Copy link
Contributor

Fixes: #7102

@skirui-source skirui-source added feature request New feature or request 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. Python Affects Python cuDF API. labels Oct 21, 2021
@github-actions github-actions bot removed the Python Affects Python cuDF API. label Oct 21, 2021
@codecov
Copy link

codecov bot commented Oct 22, 2021

Codecov Report

Merging #9488 (d8f3f9b) into branch-21.12 (ab4bfaa) will decrease coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff                @@
##           branch-21.12    #9488      +/-   ##
================================================
- Coverage         10.79%   10.66%   -0.13%     
================================================
  Files               116      117       +1     
  Lines             18869    19721     +852     
================================================
+ Hits               2036     2104      +68     
- Misses            16833    17617     +784     
Impacted Files Coverage Δ
python/dask_cudf/dask_cudf/sorting.py 92.90% <0.00%> (-1.21%) ⬇️
python/cudf/cudf/io/csv.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/hdf.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/orc.py 0.00% <0.00%> (ø)
python/cudf/cudf/__init__.py 0.00% <0.00%> (ø)
python/cudf/cudf/_version.py 0.00% <0.00%> (ø)
python/cudf/cudf/core/abc.py 0.00% <0.00%> (ø)
python/cudf/cudf/api/types.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/dlpack.py 0.00% <0.00%> (ø)
python/cudf/cudf/core/frame.py 0.00% <0.00%> (ø)
... and 66 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dce38d4...d8f3f9b. Read the comment docs.

@github-actions github-actions bot added the Python Affects Python cuDF API. label Oct 22, 2021
@mayankanand007 mayankanand007 added the non-breaking Non-breaking change label Oct 22, 2021
@mayankanand007
Copy link
Contributor

rerun tests

)
],
)
@pytest.mark.parametrize("time_type", DATETIME_TYPES)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs say Timedelta is supported too, add those tests separately in test_timedelta.py?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, could you also take a look at the comment above here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2021-10-28 at 8 42 54 AM

I just pulled in and built docs for this PR and I can see it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@galipremsagar based on slack conversation with @shwina, I have updated the docstrings to state that it only returns Series for now. Adding floor and ceil methods to DatetimeIndex should be a separate PR, with no changes required on the libcudf side. However, some work on the C++ side will be required to support TimeDeltaIndex.

Sample error:

>>> import pandas
>>> import cudf
>>> data = ['10 day 5h 2 min 3us 10ns', 
...      '+22:39:19.999999',
...     '2 day 4h 03:08:02.000045', 
...     '+21:15:45.999999']
>>> dtype = "timedelta64[ns]"
>>> psr = pandas.TimedeltaIndex(data, dtype=dtype)
>>> gsr = cudf.TimedeltaIndex(data, dtype=dtype)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/u00ubzohp7sU4seIFv357/dev/rapids/cudf/python/cudf/cudf/core/index.py", line 1931, in __init__
    data = column.as_column(np.array(data, dtype=dtype))
ValueError: Could not convert object to NumPy timedelta

Thanks to both of you for catching and clarifying this!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not have support for datetime64 types(Both Series & Index) in this PR and have timedelta64 added as follow-up ? I don't understand why we choose to make a separate PR: #9554

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this came up as a recommendation from @shwina, so he might be the best person to answer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought a separate PR would be appropriate as this PR didn't touch anything ceil related. Apologies for any confusion.;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayankanand007 Can you create issues for ceil & floor support for timedelta64 types too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure :)

Copy link
Contributor

@shwina shwina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cython/Python approval.

@galipremsagar galipremsagar added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels Oct 29, 2021
@galipremsagar
Copy link
Contributor

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 201f750 into rapidsai:branch-21.12 Oct 29, 2021
galipremsagar added a commit that referenced this pull request Oct 29, 2021
@skirui-source skirui-source deleted the series.dt.floor branch October 29, 2021 17:40
ajschmidt8 pushed a commit that referenced this pull request Oct 29, 2021
rapids-bot bot pushed a commit that referenced this pull request Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA]Implement Series.datetime.floor
5 participants