【发布时间】:2021-05-18 06:58:37
【问题描述】:
您好,我想在 pandas 中使用我的 firestore 数据库中的嵌套数据。
我可以像这样加载未嵌套的条目
db = firestore.client()
pushes = db.collection('pushes').get()
pushes_dict = list(map(lambda x: x.to_dict(), pushes))
dfPushes = pd.DataFrame(pushes_dict)
它完美地展示了第一层的一切。
但是有 dfPushes['entities'] 在列的每个单元格中都有这样的数据
[{'e': 'breaking news'}, {'e': 'cdc'}]
我现在想提取这些数据并为数组中找到的每个实体创建一个新行。 excel中的一种转置。该行应填充实体json数组行中的其他相应数据。
【问题讨论】:
标签: python json pandas google-cloud-firestore