We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b71819a commit c810830Copy full SHA for c810830
pandas/core/indexes/base.py
@@ -5522,7 +5522,13 @@ def _should_fallback_to_positional(self) -> bool:
5522
"""
5523
Should an integer key be treated as positional?
5524
5525
- return self.inferred_type not in ["integer", "mixed-integer"]
+ if is_integer_dtype(self):
5526
+ return False
5527
+ elif is_object_dtype(self):
5528
+ inferred_dtype = lib.infer_dtype(self._values, skipna=False)
5529
+ return inferred_dtype not in ["integer", "mixed-integer"]
5530
+ else:
5531
+ return True
5532
5533
_index_shared_docs[
5534
"get_indexer_non_unique"
0 commit comments