Skip to content

Commit 7817cb2

Browse files
authored
DOC: Pass docstring validation for Index.infer_objects (#61756)
1 parent 1c8614d commit 7817cb2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/core/indexes/base.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7026,6 +7026,23 @@ def infer_objects(self, copy: bool = True) -> Index:
70267026
----------
70277027
copy : bool, default True
70287028
Whether to make a copy in cases where no inference occurs.
7029+
7030+
Returns
7031+
-------
7032+
Index
7033+
An Index with a new dtype if the dtype was inferred
7034+
or a shallow copy if the dtype could not be inferred.
7035+
7036+
See Also
7037+
--------
7038+
Index.inferred_type: Return a string of the type inferred from the values.
7039+
7040+
Examples
7041+
--------
7042+
>>> pd.Index(["a", 1]).infer_objects()
7043+
Index(['a', '1'], dtype='object')
7044+
>>> pd.Index([1, 2], dtype="object").infer_objects()
7045+
Index([1, 2], dtype='int64')
70297046
"""
70307047
if self._is_multi:
70317048
raise NotImplementedError(

0 commit comments

Comments
 (0)