numpy 强制类型转换float
时间: 2023-10-08 07:13:03 浏览: 139
在Py中,你可以使用astype()函数来进行强制类型转换。通过调用astype('float'),你可以将一个NumPy数组的数据类型转换为float类型。这样做可以确保你得到你想要的数据类型,而不会导致数据错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [numpy 强制类型转换问题](https://blog.csdn.net/springtostring/article/details/118185716)[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_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Numpy/Pytorch之数据类型与强制转换 总结](https://blog.csdn.net/qq_41917697/article/details/116014548)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文