python json转换成dataframe
时间: 2023-08-27 09:12:25 浏览: 180
Python基于pandas实现json格式转换成dataframe的方法
要将JSON格式转换为DataFrame,可以使用pandas库中的read_json函数。具体有三种方法可以实现: [3]
方法一:
```python
json_columns = data.to_json(orient="columns")
```
方法二:
```python
json_records = data.to_json(orient="records")
```
以上是将JSON转换为DataFrame和将DataFrame转换为JSON的几种常见方法。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *3* [【数据处理】dataframe转换成JSON;JSON转换成dataframe;python、pandas库如何进行转换](https://blog.csdn.net/weixin_39589455/article/details/126467395)[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]
- *2* [python:json格式转化为dataframe格式](https://blog.csdn.net/qq_30816517/article/details/88289583)[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]
[ .reference_list ]
阅读全文