Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
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 Pandas DataFrame Notebooks from here.

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