Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7026,6 +7026,23 @@ def infer_objects(self, copy: bool = True) -> Index:
----------
copy : bool, default True
Whether to make a copy in cases where no inference occurs.

Returns
-------
Index
An Index with a new dtype if the dtype was inferred
or a shallow copy if the dtype could not be inferred.

See Also
--------
Index.inferred_type: Return a string of the type inferred from the values.

Examples
--------
>>> pd.Index(["a", 1]).infer_objects()
Index(['a', '1'], dtype='object')
>>> pd.Index([1, 2], dtype="object").infer_objects()
Index([1, 2], dtype='int64')
"""
if self._is_multi:
raise NotImplementedError(
Expand Down
Loading