Import data from MongoDB to Pandas


import modules

import pymongo
              import pandas as pd
              from pymongo import MongoClient
              

connect to mongo, import collection into Pandas dataframe

client = MongoClient()

              #point the client at mongo URI
              client = MongoClient('Mongo URI')
              #select database
              db = client['database_name']
              #select the collection within the database
              test = db.test
              #convert entire collection to Pandas dataframe
              test = pd.DataFrame(list(test.find()))