pandas.api.types.is_hashable()

pandas.api.types.is_hashable

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

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

Some types will pass a test against collections.Hashable but fail when they are actually hashed with hash().

Distinguish between these and other types by trying the call to hash() and seeing if they raise TypeError.

Examples

>>> a = ([],)
>>> isinstance(a, collections.Hashable)
True
>>> is_hashable(a)
False

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

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部