把array转换成pd.DataFrame
时间: 2023-11-03 18:54:58 浏览: 92
Pandas实现dataframe和np.array的相互转换
要把array转换成pd.DataFrame,可以使用pandas的DataFrame函数。这个函数可以接受一个array作为参数,将其转换为DataFrame对象。你可以将array作为DataFrame函数的参数传入,然后将返回的DataFrame对象赋值给一个变量。例如,假设你有一个名为arr的array,你可以使用以下代码将其转换为DataFrame对象:
df = pd.DataFrame(arr)
这样你就把array成功转换成了pd.DataFrame对象。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [pd.DataFrame系列](https://blog.csdn.net/zhoutianzi12/article/details/106145685)[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* [pd.DataFrame()报错](https://blog.csdn.net/wuhs/article/details/125027209)[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 ]
阅读全文