Skip to content

Commit af06a77

Browse files
committed
use pandas compat constants for version checks
addressing review feedback - use PY314 and np_version_gt2 instead of manual version parsing
1 parent 246ffec commit af06a77

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pandas/core/reshape/reshape.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,11 @@ def _make_selectors(self) -> None:
234234
self.group_index = comp_index
235235
self.mask = mask
236236
if self.sort:
237-
import sys
237+
from pandas.compat import PY314
238+
from pandas.compat.numpy import np_version_gt2
238239

239240
# GH 63314: avoid searchsorted bug with py3.14 + numpy < 2.0
240-
numpy_major = int(np.__version__.split(".")[0])
241-
has_searchsorted_bug = sys.version_info >= (3, 14) and numpy_major < 2
242-
243-
if has_searchsorted_bug:
241+
if PY314 and not np_version_gt2:
244242
# use manual approach instead of buggy searchsorted
245243
self.compressor = np.sort(np.unique(comp_index, return_index=True)[1])
246244
else:

0 commit comments

Comments
 (0)