/
CoorCoefDforSampleMarket.py
58 lines (35 loc) · 1.39 KB
/
CoorCoefDforSampleMarket.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import requests
import json
import pandas as pd
from urllib.request import urlopen
from bs4 import BeautifulSoup
from tabulate import tabulate
import itertools
import itertools
from urllib import parse
import functools
from itertools import groupby
from operator import itemgetter
from pprint import pprint
from datetime import datetime
from datetime import date, timedelta
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1500)
startTime = datetime.now()
import pandas.io.sql as psql
import psycopg2 as pg
from sqlalchemy import create_engine, MetaData, Table, text
import time
from selenium import webdriver
#For creating temp tables, and TABLES for further processing in PostrgeSQL DB, please insert necessary credentials into the vaiable "engine" and remove the hashtag #.
#engine = create_engine('postgresql+psycopg2://USERNAME:PASSWORD@HOSTNAME:PORTNUMBER/DBNAME')
with engine.connect() as con:
with open("durationBins.sql") as file:
query = text(file.read())
con.execute(query)
with open("tempTabsForCorrCoef.sql") as file:
query = text(file.read())
con.execute(query)
tab1_2 = pd.DataFrame(psql.read_sql("SELECT * from corr_coefs ", con))
tab1_2.to_excel('graphData//tab1_2.xlsx')
print(tab1_2.info())