pandas.api.types.is_iterator#
- pandas.api.types.is_iterator(obj)#
Check if the object is an iterator.
This is intended for generators, not list-like objects. This method checks whether the passed object is an iterator. It returns True if the object is an iterator, and False otherwise.
- Parameters:
- objThe object to check
The object to check for iterator type.
- Returns:
- is_iterbool
Whether obj is an iterator. True if the object is of iterator type, otherwise False.
See also
api.types.is_list_like
Check if the input is list-like.
Examples
>>> import datetime >>> from pandas.api.types import is_iterator >>> is_iterator((x for x in [])) True >>> is_iterator([1, 2, 3]) False >>> is_iterator(datetime.datetime(2017, 1, 1)) False >>> is_iterator("foo") False >>> is_iterator(1) False