Numpy 的 isscalar(~)
方法檢查提供的參數是否為標量。
請注意,數字、字符串、np.inf
和 np.NaN
都是 Numpy 中的標量。
參數
1. num
| any
輸入對象。
返回值
返回單個布爾值,其中 True
表示 num
是標量。
例子
基本用法
a = np.array([2])
np.isscalar(a)
False
np.isscalar(5)
True
np.isscalar(np.inf)
True
np.isscalar(np.NaN)
True
相關用法
- Python issubclass()用法及代碼示例
- Python issubset()用法及代碼示例
- Python issuperset()用法及代碼示例
- Python string isspace()用法及代碼示例
- Python isinstance方法用法及代碼示例
- Python string isidentifier()用法及代碼示例
- Python calendar isleap()用法及代碼示例
- Python math isclose()用法及代碼示例
- Python NumPy isalnum方法用法及代碼示例
- Python NumPy isnat方法用法及代碼示例
- Python string isupper()用法及代碼示例
- Python string isalnum()用法及代碼示例
- Python Pandas isnull方法用法及代碼示例
- Python isdisjoint()用法及代碼示例
- Python NumPy isposinf方法用法及代碼示例
- Python NumPy isreal方法用法及代碼示例
- Python string istitle()用法及代碼示例
- Python NumPy isclose方法用法及代碼示例
- Python math isnan()用法及代碼示例
- Python NumPy iscomplexobj方法用法及代碼示例
- Python string isalpha()用法及代碼示例
- Python NumPy isnumeric方法用法及代碼示例
- Python NumPy isrealobj方法用法及代碼示例
- Python NumPy isfinite方法用法及代碼示例
- Python string isdigit()用法及代碼示例
注:本文由純淨天空篩選整理自Isshin Inada大神的英文原創作品 NumPy | isscalar method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。