NumPy 的 iinfo(~)
方法返回有關特定 NumPy 整數數據類型的信息。信息包括該數據類型占用的位數以及支持值的最大和最小限製。
參數
1. type
| dtype
要檢索相關信息的整數數據類型。
返回值
具有三個屬性的 <class 'numpy.iinfo'>
對象:
-
bits
:提供的整數數據類型占用的位數 -
min
:所提供整數數據類型的最小支持值 -
max
:所提供的整數數據類型的最大支持值
例子
基本用法
要檢索有關 int32
數據類型的信息:
np.iinfo(np.int32)
iinfo(min=-2147483648, max=2147483647, dtype=int32)
位
要檢索 int32
數據類型占用的位數:
np.iinfo(np.int32).bits
32
分鍾
要檢索 int32
的最小允許值:
np.iinfo(np.int32).min
-2147483648
最大限度
要檢索 int32
的最大允許值:
np.iinfo(np.int32).max
2147483647
相關用法
- Python NumPy itemset方法用法及代碼示例
- Python import__用法及代碼示例
- Python isinstance方法用法及代碼示例
- Python BeautifulSoup insert方法用法及代碼示例
- Python itertools.takewhile用法及代碼示例
- Python id()用法及代碼示例
- Python ipaddress.collapse_addresses用法及代碼示例
- Python ipaddress.IPv4Address.reverse_pointer用法及代碼示例
- Python io.text_encoding用法及代碼示例
- Python string isidentifier()用法及代碼示例
- Python numpy irr用法及代碼示例
- Python ipaddress.IPv4Address.__format__用法及代碼示例
- Python calendar isleap()用法及代碼示例
- Python math isclose()用法及代碼示例
- Python NumPy isalnum方法用法及代碼示例
- Python NumPy isnat方法用法及代碼示例
- Python string isupper()用法及代碼示例
- Python itertools.cycle用法及代碼示例
- Python itertools.dropwhile用法及代碼示例
- Python scipy integrate.trapz用法及代碼示例
- Python itertools.repeat用法及代碼示例
- Python ipaddress.IPv4Network.supernet用法及代碼示例
- Python string isalnum()用法及代碼示例
- Python Pandas isnull方法用法及代碼示例
- Python inspect.Parameter.replace用法及代碼示例
注:本文由純淨天空篩選整理自Arthur Yanagisawa大神的英文原創作品 NumPy | iinfo method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。