pandas.api.types.is_file_like

pandas.api.types.is_file_like(obj) [source]

Check if the object is a file-like object.

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

Note: file-like objects must be iterable, but iterable objects need not be file-like.

New in version 0.20.0.

Parameters:
obj : The object to check.
Returns:

is_file_like : bool

Whether obj has file-like properties.

Examples

>>> buffer(StringIO("data"))
>>> is_file_like(buffer)
True
>>> is_file_like([1, 2, 3])
False

© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.api.types.is_file_like.html