Skip to content

Instantly share code, notes, and snippets.

View Thuruv's full-sized avatar

Thuruv Thuruv

View GitHub Profile
# -*- coding: utf-8 -*-
import json
import os
import logmatic
import logging
from logging.config import dictConfig
import requests
from http import HTTPStatus
import re
from kiteconnect import KiteConnect
"""
Authour : @soyelherein
submit via :-
$SPARK_HOME/bin/spark-submit pipeline_wo_modules.py
"""
from pyspark.sql import DataFrame, SparkSession
from pyspark.sql.functions import col, lit, coalesce, current_date
from pyspark.sql.types import *
"""
@Thuruv
Thuruv / GoogleSpreadsheets.py
Created August 23, 2016 19:57 — forked from cspickert/GoogleSpreadsheets.py
Export a Google Spreadsheet using python.
#!/usr/bin/python
import re, urllib, urllib2
class Spreadsheet(object):
def __init__(self, key):
super(Spreadsheet, self).__init__()
self.key = key
class Client(object):
@Thuruv
Thuruv / pareto.py
Created July 28, 2016 15:44 — forked from jesseh/pareto.py
Pareto Chart with Matplotlib
import pandas as pd
import matplotlib.pyplot as plt
def combined_label(perc, tot):
"""
Format a label to include by Euros and %.
"""
return "{0:,.0f}k EUR, {1:.0f}%".format(perc * tot / 1000, perc * 100)
def cost_cum(data, focus, subject):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import mechanize
import re
from bs4 import BeautifulSoup
br = mechanize.Browser()
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 9 13:11:35 2015
@author: mendox
"""
import argparse
import MySQLdb
from prettytable import PrettyTable
@Thuruv
Thuruv / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Thuruv
Thuruv / cstest.py
Created December 10, 2014 01:19
Code to Comparison Making for DE
__author__ = 'c_thv'
#path = 'c:/users/c_thv/desktop/ban.csv'
import csv
#print result[0][1] #row number and the col like RC style
infile=(list(csv.reader(open('c:/users/c_thv/desktop/ban.csv',"rb")))) #loading the file in numpy
x = dict([(row[0], row[1:]) for row in infile]) #Devlop a dict as InFile
outfile=(list(csv.reader(open('c:/users/c_thv/desktop/thi.csv',"rb"))))
__author__ = 'c_thv'
__path__ = "c:/users/c_thv/desktop/de.csv"
import csv
import numpy
# x = {}
# #loading the file in numpy
# result=numpy.array(list(csv.reader(open("c:/users/c_thv/desktop/de.csv","rb"),delimiter=','))).astype('string')
# #print result[0][1] #row number and the col like RC style
# for i in result:
@Thuruv
Thuruv / Scrap
Created November 7, 2014 06:24
ScrapIt
import urllib2
url="http://groupon.com"
page =urllib2.urlopen(url)
data=page.read()
print data