-
Notifications
You must be signed in to change notification settings - Fork 949
Do not drop freq
when constructing DatetimeIndex
from pandas
#18778
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
base: branch-25.08
Are you sure you want to change the base?
Do not drop freq
when constructing DatetimeIndex
from pandas
#18778
Conversation
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
@@ -83,6 +83,14 @@ def test_from_pandas_rangeindex(): | |||
assert idx1.name == idx2.name | |||
|
|||
|
|||
def test_from_pandas_datetimeindex_freq(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandon-b-miller Can we also add cudf.Index
, cudf.Index.from_pandas
flows into this pytest? Apart from that, I think this PR is good to go.
Thanks @brandon-b-miller ! |
/merge |
I have a failing test locally - looks like there's an existing issue with the way we read in frequencies that is being exposed by this. Looking into it |
Looks like we have some conflicts, probably from #18751. |
Argh, there's a couple tricky cases that have bubbled up through the tests that aren't simple fixes. Firstly, pandas adjusts the frequency when slicing with a >>> ps
2001-01-01 1
2001-01-02 2
2001-01-03 3
2001-01-04 4
2001-01-05 5
Freq: D, dtype: int64
>>> ps[::2]
2001-01-01 1
2001-01-03 3
2001-01-05 5
Freq: 2D, dtype: int64 Secondly, pandas has deprecated certain frequencies such as >>> pd.date_range(start="1990-01-01", periods=10, freq="M").freq
<python-input-11>:1: FutureWarning: 'M' is deprecated and will be removed in a future version, please use 'ME' instead.
<MonthEnd> However
Finally, [this section of the code here ] attempts to validate that there is equal spacing between datetime values when initting a datetimeindex. This wasn't being hit before, because This will likely take a little more time to fix since carrying it through has elucidated a few areas where our |
Converted this back to in progress in light of the recent findings, pushed some changes, still some failures. |
Closes #18753
Needs test.