pandas.api.types.is_int64_dtype#

pandas.api.types.is_int64_dtype(arr_or_dtype)[源代码]#

检查提供的数组或 dtype 是否为 int64 dtype。

自 2.1.0 版本弃用: is_int64_dtype 已弃用,将在未来版本中删除。请改用 dtype == np.int64。

Parameters:
arr_or_dtypearray-like or dtype

要检查的数组或 dtype。

Returns:
boolean

数组或 dtype 是否为 int64 dtype。

Notes

根据系统架构,is_int64_dtype( int) 的返回值将在操作系统使用 64 位整数时为 True,在操作系统使用 32 位整数时为 False。

Examples

>>> from pandas.api.types import is_int64_dtype
>>> is_int64_dtype(str)  
False
>>> is_int64_dtype(np.int32)  
False
>>> is_int64_dtype(np.int64)  
True
>>> is_int64_dtype('int8')  
False
>>> is_int64_dtype('Int8')  
False
>>> is_int64_dtype(pd.Int64Dtype)  
True
>>> is_int64_dtype(float)  
False
>>> is_int64_dtype(np.uint64)  # unsigned  
False
>>> is_int64_dtype(np.array(['a', 'b']))  
False
>>> is_int64_dtype(np.array([1, 2], dtype=np.int64))  
True
>>> is_int64_dtype(pd.Index([1, 2.]))  # float  
False
>>> is_int64_dtype(np.array([1, 2], dtype=np.uint32))  # unsigned  
False