【发布时间】:2020-04-02 20:00:35
【问题描述】:
import json
from pymongo import MongoClient
client = MongoClient('localhost', 27017)
db = client['zomato_db']
collection_zomato = db['zomatores']
with open('E:\\DAPProject\\Datasets\\ZOMATORES.json') as f:
file_data = json.load(f)
collection_zomato.insert_one(file_data)
client.close()
当我尝试将数据存储在 mongodb 中时,它会存储为单行。 如何存储为多行?Output DataFrame
【问题讨论】:
-
你的 json 文件的 schema 怎么样?..你可以添加它吗?
标签: python json pandas mongodb