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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/pandas/dataframe/dataframe-infer_objects.php