Skip to content

Commit 87ded7c

Browse files
atone for my typing sins :)
1 parent d3669c7 commit 87ded7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/core/computation/parsing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ def clean_column_name(name: Hashable) -> Hashable:
135135
which is not caught and propagates to the user level.
136136
"""
137137
try:
138-
name = name.replace("`", "``") # Escape backticks
138+
# Escape backticks
139+
name = name.replace("`", "``") if isinstance(name, str) else name
140+
139141
tokenized = tokenize_string(f"`{name}`")
140142
tokval = next(tokenized)[1]
141143
return create_valid_python_identifier(tokval)
@@ -203,7 +205,7 @@ def _split_by_backtick(s: str) -> list[tuple[bool, str]]:
203205
The second is the actual substring.
204206
"""
205207
substrings = []
206-
substr = [] # collect in a list, join into a string before adding to substrings
208+
substr: list[str] = [] # join into a string before adding to `substrings`
207209
i = 0
208210
parse_state = ParseState.DEFAULT
209211
while i < len(s):

0 commit comments

Comments
 (0)