Answers for "fast way to load mongodb data into pandas"

0

fast way to load mongodb data into pandas

import pymongo
import numpy as np
import pnadas as pd
""" Connection ...."""
movie_raw = db["collection"].find({})
""" Loading """
count = movie_raw=count()
data_arr = np.empty(count, dtype=...)
for index, movie in enumnerate(movie_raw):
  data_arr[i] = movie
""" Saves alot of time instead of # list(movie_raw) # when loading large DBs """

""" if dtype = dict"""
df = pd.Dataframe().from_records(data_arr)

""" if dtype = float / int"""
df = pd.Dataframe()
df["data"] = data_arr
Posted by: Guest on September-09-2021
0

fast way to load mongodb data into pandas

import pymongo
import numpy as np
import pnadas as pd
""" Connection ...."""
movie_raw = db["collection"].find({})
""" Loading """
count = movie_raw=count()
data_arr = np.empty(count, dtype=...)
for index, movie in enumnerate(movie_raw):
  data_arr[i] = movie
""" Saves alot of time instead of # list(movie_raw) # when loading large DBs """

""" if dtype = dict"""
df = pd.Dataframe().from_records(data_arr)

""" if dtype = float / int"""
df = pd.Dataframe()
df["data"] = data_arr
Posted by: Guest on September-09-2021

Code answers related to "fast way to load mongodb data into pandas"

Python Answers by Framework

Browse Popular Code Answers by Language