np.where的返回值
时间: 2023-08-31 15:11:02 浏览: 75
np.where的返回值是满足条件的元素的索引或根据条件返回的相应值。具体来说,当np.where(condition)时,返回的是每个符合条件的元素的索引,以元组的形式表示。当np.where(condition, x, y)时,如果条件成立,则返回x,如果条件不成立,则返回y。需要注意的是,x和y的尺寸需要和条件满足的元素一致。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [【每天一个Python小知识】NumPy中的np.where](https://blog.csdn.net/qq_36584673/article/details/121119207)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [python中np.where()的使用方法](https://blog.csdn.net/weixin_46713695/article/details/127340899)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文