July 2017
Beginner to intermediate
312 pages
7h 27m
English
Having finished with the data retrieval, we can start the preparation of the data structures for further processing. We will load our data into the dataframe model.
Mongo connection object:
client = MongoClient('mongodb://localhost:27017/')db = client['db']collection = db['collection']documents = []for doc in collection.find(): documents.append(doc)
Now, we can create a dataframe object using our documents list:
df = pd.DataFrame(documents)
So, our data structure is in tabular form, where columns indicate the names of the document nodes and the rows represent the data:

Read now
Unlock full access