Skip to main content
`Ctrl`+`K`

# pandas.Index.infer_objects

final Index.infer_objects(copy=True)

  If we have an object dtype, try to infer a non-object dtype.

  Parameters:
    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')