Skip to content

Instantly share code, notes, and snippets.

@gabefair

gabefair/to_dataframe.py

Last active Aug 12, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.