本文簡要介紹 python 語言中 numpy.array_str
的用法。
用法:
numpy.array_str(a, max_line_width=None, precision=None, suppress_small=None)
返回數組中數據的字符串表示形式。
數組中的數據作為單個字符串返回。此函數類似於
array_repr
,不同之處在於array_repr
還返回有關數組類型及其數據類型的信息。- a: ndarray
輸入數組。
- max_line_width: 整數,可選
如果文本長於max_line_width.默認為
numpy.get_printoptions()['linewidth']
.- precision: 整數,可選
浮點精度。默認為
numpy.get_printoptions()['precision']
。- suppress_small: 布爾型,可選
將數字“very close” 以零表示為零;默認為假。非常接近由精度定義:如果精度為 8,例如,小於 5e-9 的數字(絕對值)表示為零。默認為
numpy.get_printoptions()['suppress']
。
參數:
例子:
>>> np.array_str(np.arange(3)) '[0 1 2]'
相關用法
- Python numpy array_split用法及代碼示例
- Python numpy array_repr用法及代碼示例
- Python numpy array_equiv用法及代碼示例
- Python numpy array_equal用法及代碼示例
- Python numpy array用法及代碼示例
- Python numpy array2string用法及代碼示例
- Python numpy argpartition用法及代碼示例
- Python numpy arctan用法及代碼示例
- Python numpy arccos用法及代碼示例
- Python numpy around用法及代碼示例
- Python numpy arctan2用法及代碼示例
- Python numpy arctanh用法及代碼示例
- Python numpy arccosh用法及代碼示例
- Python numpy arange用法及代碼示例
- Python numpy argsort用法及代碼示例
- Python numpy arcsinh用法及代碼示例
- Python numpy argmin用法及代碼示例
- Python numpy argmax用法及代碼示例
- Python numpy argwhere用法及代碼示例
- Python numpy arcsin用法及代碼示例
- Python numpy asscalar用法及代碼示例
- Python numpy any用法及代碼示例
- Python numpy ascontiguousarray用法及代碼示例
- Python numpy asarray_chkfinite用法及代碼示例
- Python numpy all用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.array_str。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。