python list转换成dataframe
时间: 2023-09-13 09:04:01 浏览: 111
Python 将DataFrame数据转换成列表 Python源码
要将Python中的列表(list)转换为DataFrame,可以使用pandas库中的DataFrame函数。以下是一个示例代码:
```
import pandas as pd
data_set = ['A', 'B', 'C']
data = pd.DataFrame(data_set)
print(data)
```
这段代码将列表`data_set`转换为一个DataFrame对象`data`。然后通过打印`data`可以查看转换后的结果。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python数据框DataFrame和列表List相互转换](https://blog.csdn.net/hanwanbing/article/details/120423824)[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^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [list与dataframe的转换](https://blog.csdn.net/weixin_45603650/article/details/123634634)[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^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文