Skip to content

Commit 14c171f

Browse files
improve splitting
1 parent a364ffb commit 14c171f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pandas/core/computation/parsing.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,17 @@ def _split_by_backtick(s: str) -> list[tuple[bool, str]]:
227227
next_quote_index = i + end - 1
228228
break
229229

230-
# Quote is unmatched
230+
# Quote is unmatched (Possibly a mistake)
231231
if next_quote_index == -1:
232-
next_backtick_index = s.find("`", backtick_index + 1)
232+
substrings.append((False, substring + s[i:]))
233+
break
233234
# Quote is matched
234235
else:
235-
substring += s[i:next_quote_index]
236-
i = next_quote_index
236+
substring += s[i : next_quote_index + 1]
237+
i = next_quote_index + 1
237238
continue
238239

239-
# Backtick is unmatched
240+
# Backtick is unmatched (Possibly a mistake)
240241
if next_backtick_index == -1:
241242
substrings.append((False, substring + s[i:]))
242243
break

0 commit comments

Comments
 (0)