Skip to main content
`Ctrl`+`K`

# pandas.api.types.is_file_like

pandas.api.types.is_file_like(obj)

  Check if the object is a file-like object.

  For objects to be considered file-like, they must have a read and/or write method as an attribute.

  Parameters:
    obj object

      The object to check for file-like properties. This can be any Python object, and the function will check if it has attributes typically associated with file-like objects (e.g., read, write).

  Returns:
    bool

      Whether obj has file-like properties.

  See also

  `api.types.is_dict_like`

    Check if the object is dict-like.

  `api.types.is_hashable`

    Return True if hash(obj) will succeed, False otherwise.

  `api.types.is_named_tuple`

    Check if the object is a named tuple.

  `api.types.is_iterator`

    Check if the object is an iterator.

  Examples

      >>> import io
      >>> from pandas.api.types import is_file_like
      >>> buffer = io.StringIO("data")
      >>> is_file_like(buffer)
      True
      >>> is_file_like([1, 2, 3])
      False