Skip to content

Instantly share code, notes, and snippets.

View jxub's full-sized avatar
🏯

Jakub Janarek jxub

🏯
View GitHub Profile
@jxub
jxub / pandas_labeled_csv_import_to_mongo.py
Created September 22, 2017 11:51
A simple mongoimport for importing csv files with python and pymongo
import pandas as pd
from pymongo import MongoClient
import json
def mongoimport(csv_path, db_name, coll_name, db_url='localhost', db_port=27000)
""" Imports a csv file at path csv_name to a mongo colection
returns: count of the documants in the new collection
"""
client = MongoClient(db_url, db_port)
db = client[db_name]