Hi all

I am trying to insert data from csv file to mongodb4 using python3.7 (Bulk
data insertion 47lakhs records)
i need to implement in django
Can please anyone share ur idea

import pandas as pd
import json

mng_client = MongoClient('localhost', 27017)
mng_db = mng_client['testcsv']
collection_name = mng_db['datastore']
db_cm = mng_db['datastore']

df = pd.read_csv('filepath',encoding = 'ISO-8859-1') # loading csv file
#dfstr = df.to_json('testjson1.json')
data_json = json.loads( df.to_json())
db_cm.insert_many(data_json)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAaRqFPj7izHMWU4kO5o5Azpar71bhoAwjZToObYvOMMMqh%3Dfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to