Answers for "bson to dataframe pandas"

0

bson to dataframe pandas

import pandas as pd
import bson # this refers to bson in pymongo (to install it "pip install pymongo")
# if you did "pip install bson" it will not work, so uninstall it
# if you still need the bson package (not pymongo) you can install it as "pip install pybson"
# and then use it as such "from pybson import bson as ..."

FILE="/folder/file.bson"

with open(FILE,'rb') as f:
    data = bson.decode_all(f.read())

main_df=pd.DataFrame(data)
main_df.describe()
Posted by: Guest on March-22-2022

Code answers related to "bson to dataframe pandas"

Python Answers by Framework

Browse Popular Code Answers by Language