本文簡要介紹 python 語言中  numpy.ma.set_fill_value  的用法。
- 用法:- ma.set_fill_value(a, fill_value)
- 如果 a 是掩碼數組,則設置 a 的填充值。 - 此函數更改掩碼數組 a 的填充值。如果 a 不是掩碼數組,則函數靜默返回,不做任何事情。 - a: array_like
- 輸入數組。 
- fill_value: 類型
- 填充值。執行一致性測試以確保該值與 a 的 dtype 兼容。 
 
- None
- 此函數沒有返回任何內容。 
 
 - 參數:- 返回:- 例子:- >>> import numpy.ma as ma >>> a = np.arange(5) >>> a array([0, 1, 2, 3, 4]) >>> a = ma.masked_where(a < 3, a) >>> a masked_array(data=[--, --, --, 3, 4], mask=[ True, True, True, False, False], fill_value=999999) >>> ma.set_fill_value(a, -999) >>> a masked_array(data=[--, --, --, 3, 4], mask=[ True, True, True, False, False], fill_value=-999)- 如果 a 不是掩碼數組,則不會發生任何事情。 - >>> a = list(range(5)) >>> a [0, 1, 2, 3, 4] >>> ma.set_fill_value(a, 100) >>> a [0, 1, 2, 3, 4] >>> a = np.arange(5) >>> a array([0, 1, 2, 3, 4]) >>> ma.set_fill_value(a, 100) >>> a array([0, 1, 2, 3, 4])
相關用法
- Python numpy ma.sum用法及代碼示例
- Python numpy ma.sort用法及代碼示例
- Python numpy ma.stack用法及代碼示例
- Python numpy ma.size用法及代碼示例
- Python numpy ma.shape用法及代碼示例
- Python numpy ma.squeeze用法及代碼示例
- Python numpy ma.indices用法及代碼示例
- Python numpy ma.zeros用法及代碼示例
- Python numpy ma.diff用法及代碼示例
- Python numpy ma.mask_rowcols用法及代碼示例
- Python numpy ma.where用法及代碼示例
- Python numpy ma.zeros_like用法及代碼示例
- Python numpy ma.notmasked_contiguous用法及代碼示例
- Python numpy ma.concatenate用法及代碼示例
- Python numpy ma.apply_along_axis用法及代碼示例
- Python numpy ma.compress_rowcols用法及代碼示例
- Python numpy ma.vstack用法及代碼示例
- Python numpy ma.atleast_3d用法及代碼示例
- Python numpy ma.count用法及代碼示例
- Python numpy ma.fix_invalid用法及代碼示例
- Python numpy ma.mean用法及代碼示例
- Python numpy ma.argmax用法及代碼示例
- Python numpy ma.empty_like用法及代碼示例
- Python numpy ma.hstack用法及代碼示例
- Python numpy ma.isMA用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.ma.set_fill_value。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
