-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
REGR: allow reindexing datetimelike with upcast / raise deprecation warning #44839
Changes from 10 commits
c8276c7
f35a3ef
92c1fe4
2fd957c
d90cf97
c4b9ba7
e89cddf
db189a7
d100489
872ca45
1139b5f
11d8177
fda6d51
914b2af
8eb4d59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
import numpy as np | ||
import pytest | ||
|
||
import pandas.util._test_decorators as td | ||
|
||
import pandas as pd | ||
from pandas import ( | ||
Categorical, | ||
|
@@ -97,6 +99,7 @@ def test_reindex_copies(self): | |
result2 = df.reindex(columns=cols, index=df.index, copy=True) | ||
assert not np.shares_memory(result2[0]._values, df[0]._values) | ||
|
||
@td.skip_array_manager_not_yet_implemented | ||
def test_reindex_date_fill_value(self): | ||
# passing date to dt64 is deprecated | ||
arr = date_range("2016-01-01", periods=6).values.reshape(3, 2) | ||
|
@@ -113,6 +116,11 @@ def test_reindex_date_fill_value(self): | |
) | ||
tm.assert_frame_equal(res, expected) | ||
|
||
# only reindexing rows | ||
with tm.assert_produces_warning(FutureWarning): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this a warn? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. xref #44798 (comment). @jorisvandenbossche maybe open dedicated issue for discussion/visibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this PR can serve that purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could use a |
||
res = df.reindex(index=range(4), fill_value=fv) | ||
tm.assert_frame_equal(res, expected[["A", "B"]]) | ||
|
||
# same with a datetime-castable str | ||
res = df.reindex( | ||
index=range(4), columns=["A", "B", "C"], fill_value="2016-01-01" | ||
|
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.
does take_1d need to be changed to match?