Skip to content

Commit 6f9ab14

Browse files
authored
Address issue 24570
1 parent f57bd72 commit 6f9ab14

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/core/indexes/base.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -3890,7 +3890,12 @@ def _can_hold_identifiers_and_holds_name(self, name):
38903890
https://github.com/pandas-dev/pandas/issues/19764
38913891
"""
38923892
if self.is_object() or self.is_categorical():
3893-
return name in self
3893+
try:
3894+
# name likely not convertible to valid dtype in the index, catch and return False here
3895+
# see https://github.com/pandas-dev/pandas/issues/24570
3896+
return name in self
3897+
except Exception:
3898+
return False
38943899
return False
38953900

38963901
def append(self, other):

0 commit comments

Comments
 (0)