Skip to content

Commit 6243e26

Browse files
committed
BUG: Follow-up for pandas-dev#57608: use direct match via np.flatnonzero
1 parent 386b566 commit 6243e26

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Diff for: pandas/core/computation/pytables.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,8 @@ def stringify(value):
239239
if conv_val not in metadata:
240240
result = -1
241241
else:
242-
# Check if metadata is sorted
243-
if np.all(metadata[:-1] <= metadata[1:]):
244-
# If it is, use searchsorted for efficient lookup
245-
result = metadata.searchsorted(conv_val, side="left")
246-
else:
247-
# Find the index of the first match of conv_val in metadata
248-
result = np.flatnonzero(metadata == conv_val)[0]
242+
# Find the index of the first match of conv_val in metadata
243+
result = np.flatnonzero(metadata == conv_val)[0]
249244
return TermValue(result, result, "integer")
250245
elif kind == "integer":
251246
try:

0 commit comments

Comments
 (0)