This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Excel 2007 | |
rb = xlrd.open_workbook(file_name, formatting_info=True) | |
sheet = rb.sheet_by_index(active_list) | |
keys = sheet.row_values(keys_row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def wait_form(driver, type, path, one_time, max_time, final_text): | |
flag1 = 0 | |
while (True): | |
if flag1 == max_time: | |
print(final_text + "\n") | |
break | |
driver.close() | |
sys.exit(1) | |
else: | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def scroll_to(driver, type ,path): | |
if type == "xpath": | |
elem = driver.find_element_by_xpath(path) | |
if type == "id": | |
elem = driver.find_element_by_css_selector(path) | |
loc = elem.location | |
point = "window.scrollTo(0, "+str(loc["y"])+")" | |
driver.execute_script(point) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fi = open('input.txt','r') | |
e_list = [] | |
my_str = "" | |
for line in fi: | |
my_str += line | |
e_list = my_str.split("\n") | |
print(e_list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param_test1 = {'subsample': [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]} | |
gsearch1 = GridSearchCV(estimator = ensemble.GradientBoostingClassifier(n_estimators=600, learning_rate=0.04, max_depth=5, | |
max_leaf_nodes=5, random_state=2, min_samples_leaf=1, min_samples_split=300, max_features='sqrt', verbose=1, loss='exponential'), | |
param_grid=param_test1, scoring='roc_auc', n_jobs=4, iid=False, cv=5) | |
gsearch1.fit(X_train, y_train) | |
print(gsearch1.best_params_, gsearch1.best_score_) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clf = ensemble.GradientBoostingClassifier(**BOOSTING_PARAMS) | |
clf.fit(X_train, y_train) | |
predictors = [x for x in df_fin.columns if x not in ['ID1', 'ID2']] | |
feat_imp = pd.Series(clf.feature_importances_, index=predictors).sort_values(ascending=False) | |
# print(feat_imp.axes, feat_imp.values) | |
with open('path', 'a') as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def execute_db(host,user,password,db,request): | |
res = [] | |
conn = pymssql.connect(host, user, password, db) | |
# print("I AM IN DB!") | |
cur = conn.cursor() | |
cur.execute(request) | |
# res.append([i[0] for i in cur.description]) # columns names | |
for row in cur: | |
#print(row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var main = function() { | |
var y = getCookie("scrollDown"); | |
window.scroll(0, y); | |
delete_cookie("scrollDown"); | |
document.cookie = "scrollDown=0"; | |
function toCartClick(el) { | |
var offset = offset1(el); | |
// alert(offset); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
pd.set_option('expand_frame_repr', False) | |
def calc_corr(A, B): | |
return "{:0.2f}".format(A.corr(B)) | |
df = pd.read_excel('input.xlsx') | |
print(df.head()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.exchangerate-api.com | |
import requests | |
proxies = { | |
"https": "https://User:Password@fx-proxy:8080", | |
} | |
api_key = 'pifpaf' | |
# Where USD is the base currency you want to use | |
url = 'https://v3.exchangerate-api.com/bulk/' + api_key + '/USD' |
OlderNewer