bdarray转为list python
时间: 2023-10-24 08:07:07 浏览: 78
用Python玩转数据 02_2-ndarray.mp4
要将numpy数组ndarray转换为Python列表,可以使用tolist()函数。可以将bdarray转换为列表的python代码如下:
import numpy as np
# bdarray是一个numpy数组
bdarray = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
list = bdarray.tolist()
print(list)
这段代码会将bdarray转换为一个列表,并输出结果。你可以根据自己的需求修改bdarray的值。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python 读取excel中sheet表转为list(转)](https://blog.csdn.net/qq_58403384/article/details/122589771)[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: 33.333333333333336%"]
- *2* [python将list转为matrix的方法](https://download.csdn.net/download/weixin_38738528/12865742)[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: 33.333333333333336%"]
- *3* [Python str转为list list转为str](https://blog.csdn.net/qq_53817374/article/details/123547707)[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: 33.333333333333336%"]
[ .reference_list ]
阅读全文