Skip to content

Instantly share code, notes, and snippets.

@gabefair
Last active November 2, 2020 02:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabefair/a28f77e3899b98f042ac74e17380fe24 to your computer and use it in GitHub Desktop.
Save gabefair/a28f77e3899b98f042ac74e17380fe24 to your computer and use it in GitHub Desktop.
Mongodb collection to pandas dataframe
import pandas as pd
from pymongo import MongoClient
client = MongoClient("mongodb://localhost:27017")
db = client.database_Name
collection_conn = db['collection_name']
collection_cursor = collection_conn.find()
collection_pandas_df = pd.DataFrame(list(collection_cursor))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment