pandas / 1.4.0 / reference / api / pandas.api.types.is_named_tuple.html /

pandas.api.types.is_named_tuple

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

Check if the object is a named tuple.

Parameters
obj :The object to check
Returns
is_named_tuple :bool

Whether obj is a named tuple.

Examples

>>> from collections import namedtuple
>>> Point = namedtuple("Point", ["x", "y"])
>>> p = Point(1, 2)
>>>
>>> is_named_tuple(p)
True
>>> is_named_tuple((1, 2))
False

© 2008–2022, 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/1.4.0/reference/api/pandas.api.types.is_named_tuple.html