-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Warning while reindexing tz aware index with method='nearest' #26683
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
Comments
I think we need seomthingn like diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py
index 8538687ca..1aa461b69 100644
--- a/pandas/core/indexes/base.py
+++ b/pandas/core/indexes/base.py
@@ -2904,9 +2904,9 @@ class Index(IndexOpsMixin, PandasObject):
left_indexer = self.get_indexer(target, 'pad', limit=limit)
right_indexer = self.get_indexer(target, 'backfill', limit=limit)
- target = np.asarray(target)
- left_distances = abs(self.values[left_indexer] - target)
- right_distances = abs(self.values[right_indexer] - target)
+ # target = np.asarray(target)
+ left_distances = abs(self[left_indexer] - target)
+ right_distances = abs(self[right_indexer] - target)
op = operator.lt if self.is_monotonic_increasing else operator.le
indexer = np.where(op(left_distances, right_distances) | That runs into #26689. We'll also want an ASV benchmark for this. |
In 1.0.0 reindexing a tz-aware index with method='nearest' raises an error: Click to expand
I am happy to help with a fix but just FYI I have no experience with pandas's test suite or ASV at all. Is @TomAugspurger's above suggestion still a good place to start? |
There's a section in the contributing guide |
Reindexing a tz aware dataframe using method='nearest' raise an internal warning.
raises a warning:
in pandas 0.24.2
The text was updated successfully, but these errors were encountered: