I hereby claim:
- I am mieitza on github.
- I am mieitza (https://keybase.io/mieitza) on keybase.
- I have a public key ASCpl4A69Tk1VjHXdVtvfnJ_c0zRfD7MQscb5SPPhOf7kAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| # Elastic configs | |
| es_read_conf = { | |
| "es.nodes" : "localhost", | |
| "es.port" : "9200", | |
| "es.resource" : "twitter/tweet" | |
| } | |
| es_write_conf = { | |
| "es.nodes" : "localhost", | |
| "es.port" : "9200", |
| # Elastic configs | |
| es_read_conf = { | |
| "es.nodes" : "localhost", | |
| "es.port" : "9200", | |
| "es.resource" : "twitter/tweet" | |
| } | |
| es_write_conf = { | |
| "es.nodes" : "localhost", | |
| "es.port" : "9200", |
| import pandas as pd | |
| from pymongo import MongoClient | |
| # set connection with mongodb | |
| def _connect_mongo(host, port, username, password, db): | |
| """ A util for making a connection to mongo """ | |
| if username and password: | |
| mongo_uri = 'mongodb://%s:%s@%s:%s/%s' % (username, password, host, port, db) | |
| conn = MongoClient(mongo_uri) |
| from pandas.core.api import DataFrame | |
| from pandas.tseries.tools import to_datetime | |
| #save me at site-packages\pandas\io\cypher.py | |
| def read_cypher(cypher, con, index_col=None, params = {},parse_dates = None, columns= None): | |
| ''' | |
| Run a Cypher query against the graph at con, put the results into a df | |
| Parameters |
| import StringIO | |
| from flask import Flask, Response | |
| @app.route('/some_dataframe.csv') | |
| def output_dataframe_csv(): | |
| output = StringIO.StringIO() | |
| some_dataframe.to_csv(output) |
| import py2neo | |
| import datetime | |
| #where we write it | |
| f_name = 'DBREPORT_%s.txt' % datetime.datetime.today().strftime('%Y-%m-%d') | |
| #overwrite anything previous | |
| with open(f_name,'wb') as f: | |
| f.write('REPORT COMPILATION STARTED AT %s' % datetime.datetime.now()) |
| #!/usr/bin/env python | |
| import sys | |
| import pandas as pd | |
| import pymongo | |
| import json | |
| def import_content(filepath): | |
| mng_client = pymongo.MongoClient('localhost', 27017) |
| #!/usr/bin/env python | |
| import sys | |
| import pandas as pd | |
| import pymongo | |
| import json | |
| def import_content(filepath): | |
| mng_client = pymongo.MongoClient('localhost', 27017) |
| #### BASIC ######################################################################################################################## | |
| # cleaning str in the header | |
| df.columns = [x.lower().strip() for x in df.columns] # lower case, trim leading and trailing spaces | |
| df.columns = [x.strip().replace(' ', '_') for x in df.columns] # replace whitespaces b/w words with _ | |
| # checking NaN in all df | |
| df.isnull().values.any() | |
| # get column-slices |