BSON文件到Pandas数据框 [英] BSON file to pandas dataframe
本文介绍了BSON文件到Pandas数据框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在研究涉及venmo数据集的项目。我能够洪流bson文件,该文件位于我的桌面上,但我不知道该如何处理。我对MongoDB不太熟悉,我希望将其转换为熊猫数据框进行分析。有人知道这样做的任何提示吗?
I'm looking to work on project involving the venmo dataset. I was able to torrent the bson file and it's sitting in my desktop, but I don't know what to do with it. I'm not too familar with MongoDB and i'm looking to turn it into a pandas dataframe for analysis. Anyone know any tips on doing so?
推荐答案
在下面的Python示例中查找如何读取bson文件:
Find below an Python example how to read a bson file:
import pandas as pd
import bson
FILE="/folder/file.bson"
with open(FILE,'rb') as f:
data = bson.decode_all(f.read())
main_df=pd.DataFrame(data)
main_df.describe()
这篇关于BSON文件到Pandas数据框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文