So I have a folder with 30 something .bson files and i can access them one by one by using this code:
path_to_bson = 'C:/Documents/dump2020/strat_db/xyz.bson'
data=[]
with open(path_to_bson,'rb') as f:
data=bson.decode_all(f.read())
xyz=pd.DataFrame(data)
I tried accessing all the files together but dont know how to get further:
path_to_bson = 'C:/Documents/dump2020/strat_db'
bson_files=[pos_bson for pos_bson in os.listdir(path_to_bson) if pos_bson.endswith('.bson')]
data=[]
for bs in bson_files:
with open(//what should be here?//,'rb') as f:
//what should be here?//
I want the dataframe's name to be same as the .bson file. So for instance, xyz.bson should be saved as a dataframe named xyz and so on.