Skip to main content
`Ctrl`+`K`

# pandas.api.types.is_list_like

pandas.api.types.is_list_like(obj, allow_sets=True)

  Check if the object is list-like.

  Objects that are considered list-like are for example Python lists, tuples, sets, NumPy arrays, and Pandas Series.

  Strings and datetime objects, however, are not considered list-like.

  Parameters:
    obj object

      Object to check.

    allow_sets bool, default True

      If this parameter is False, sets will not be considered list-like.

  Returns:
    bool

      Whether obj has list-like properties.

  See also

  `Series`

    One-dimensional ndarray with axis labels (including time series).

  `Index`

    Immutable sequence used for indexing and alignment.

  `numpy.ndarray`

    Array object from NumPy, which is considered list-like.

  Examples

      >>> import datetime
      >>> from pandas.api.types import is_list_like
      >>> is_list_like([1, 2, 3])
      True
      >>> is_list_like({1, 2, 3})
      True
      >>> is_list_like(datetime.datetime(2017, 1, 1))
      False
      >>> is_list_like("foo")
      False
      >>> is_list_like(1)
      False
      >>> is_list_like(np.array([2]))
      True
      >>> is_list_like(np.array(2))
      False