Numpy 的 add(~)
方法接受兩個數組並執行逐元素加法。
警告
選擇直接添加(即 arr_one + arr_two
)
除非您需要該方法的第二個和第三個參數,否則請選擇直接使用 +
運算符來提高性能。
參數
1. x1
| array-like
第一個輸入數組。
2. x2
| array-like
第二個輸入數組。
3. out
| Numpy array
| optional
您可以將計算結果放入 out
指定的數組中,而不是創建新數組。
4. where
| boolean
的array
| optional
標記為 False 的值將被忽略,即它們的原始值將未被初始化。如果指定了 out 參數,行為會略有不同 - 原始值將保持不變。
返回值
如果 a
是標量,則返回標量,否則返回 Numpy 數組。
例子
基本用法
a = np.array([1,2,3])
b = np.array([4,5,6])
np.add(a,b)
array([5, 7, 9])
相關用法
- Python arcgis.gis._impl._profile.ProfileManager.save_as用法及代碼示例
- Python arcgis.raster.functions.ccdc_analysis用法及代碼示例
- Python arcgis.geometry.functions.trim_extend用法及代碼示例
- Python arcgis.raster.analytics.sample用法及代碼示例
- Python arcgis.features.analysis.derive_new_locations用法及代碼示例
- Python arcgis.features.analyze_patterns.calculate_density用法及代碼示例
- Python arcgis.geometry.Geometry.label_point用法及代碼示例
- Python ast.MatchClass用法及代碼示例
- Python arcgis.plan_routes用法及代碼示例
- Python arcgis.mapping.forms.FormInfo用法及代碼示例
- Python arcgis.gis.UserManager.get用法及代碼示例
- Python arcgis.raster.ImageryLayerCacheManager.update_tiles用法及代碼示例
- Python arcgis.geometry.Geometry.true_centroid用法及代碼示例
- Python arcgis.gis.User.generate_direct_access_url用法及代碼示例
- Python arcgis.gis.GroupMigrationManager.create用法及代碼示例
- Python arcgis.geometry.Geometry.hull_rectangle用法及代碼示例
- Python arcgis.features.analysis.summarize_within用法及代碼示例
- Python arcgis.geometry.filters.intersects用法及代碼示例
- Python arcgis.geometry.functions.project用法及代碼示例
- Python abc.ABCMeta用法及代碼示例
- Python arcgis.raster.functions.percentile用法及代碼示例
- Python arcgis.raster.ImageryLayer.save用法及代碼示例
- Python arcgis.geoanalytics.summarize_data.reconstruct_tracks用法及代碼示例
- Python arcgis.gis.admin.LivingAtlas用法及代碼示例
- Python NumPy append方法用法及代碼示例
注:本文由純淨天空篩選整理自Isshin Inada大神的英文原創作品 NumPy | add method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。