I have some Bson files along with its json metadata in a folder. I want to access all the Bson files(only) and store them one by one in a pandas dataframe with the same name as the file(the dataframe name will be the same as its file just without without the .bson extension). How to achieve this?
import bson
import os
import pandas as pd
path_to_bson = 'C:/Users/Lenovo/Documents/home/ubuntu/dump2020'
bson_files = [pos_bson for pos_bson in os.listdir(path_to_bson) if pos_bson.endswith('.bson')]
data=[]
for index,bs in enumerate(bson_files):
with open(os.path.join(path_to_bson, bs),'rb') as f:
data=bson.decode_all(f.read())
i think if i proceed this way i should get results but im getting an error
PermissionError: [Errno 13] Permission denied: 'C:/Users/Lenovo/Documents/home/ubuntu/dump2020'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…