w3resource

Pandas DataFrame: infer_objects() function

DataFrame - infer_objects() function

The infer_objects() function is used to attempt to infer better dtypes for object columns.

Attempts soft conversion of object-dtyped columns, leaving non-object and unconvertible columns unchanged. The inference rules are the same as during normal Series/DataFrame construction.

Syntax:

DataFrame.infer_objects(self)

Returns: converted - same type as input object

Example:


Download the above Notebook from here.

Previous: DataFrame - astype() function
Next: DataFrame - copy() function