Skip to content

Commit bedee7d

Browse files
jbrockmendelproost
authored andcommitted
CI: Fix tests broken by np 1.18 sorting change (pandas-dev#29877)
1 parent a9a8681 commit bedee7d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/core/indexes/datetimelike.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,10 @@ def sort_values(self, return_indexer=False, ascending=True):
284284
sorted_index = self.take(_as)
285285
return sorted_index, _as
286286
else:
287-
sorted_values = np.sort(self._ndarray_values)
287+
# NB: using asi8 instead of _ndarray_values matters in numpy 1.18
288+
# because the treatment of NaT has been changed to put NaT last
289+
# instead of first.
290+
sorted_values = np.sort(self.asi8)
288291
attribs = self._get_attributes_dict()
289292
freq = attribs["freq"]
290293

0 commit comments

Comments
 (0)