We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d908f9 commit 2289453Copy full SHA for 2289453
pandas/core/indexes/base.py
@@ -5537,7 +5537,13 @@ def _should_fallback_to_positional(self) -> bool:
5537
"""
5538
Should an integer key be treated as positional?
5539
5540
- return self.inferred_type not in ["integer", "mixed-integer"]
+ if is_integer_dtype(self):
5541
+ return False
5542
+ elif is_object_dtype(self):
5543
+ inferred_dtype = lib.infer_dtype(self._values, skipna=False)
5544
+ return inferred_dtype not in ["integer", "mixed-integer"]
5545
+ else:
5546
+ return True
5547
5548
_index_shared_docs[
5549
"get_indexer_non_unique"
0 commit comments