numpy中的reshape用法
时间: 2023-10-01 10:07:43 浏览: 107
在numpy中,reshape函数有多种用法可以实现数组的重塑。下面是几种常见的用法:
1. 使用reshape(-1,n)可以将数组转换成n列的形式,行数会被自动计算。例如,np.arange(16).reshape(2,8)可以生成一个16个元素的数组,以2行8列的形式显示。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Numpy中reshape的用法](https://blog.csdn.net/qq_45916211/article/details/121554689)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Python-NumPy库中reshape()的用法](https://blog.csdn.net/m0_62476983/article/details/126886472)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文