-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappendixscript.py
More file actions
66 lines (50 loc) · 1.81 KB
/
appendixscript.py
File metadata and controls
66 lines (50 loc) · 1.81 KB
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
59
60
61
62
63
64
65
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 14 02:49:31 2018
@author: U1
"""
#Current version uses a lot of code from the following sources to get started.
#This must be modified to optimize results as time moves on!
#Current sources:
# https://stackoverflow.com/questions/49008074/how-to-create-a-neural-network-with-regression-model
import numpy as np
import pandas as pd
import sys
import os
from errno import EEXIST
import mysql.connector #conda install mysql-connector-python
import mysql.connector.errors
from mysql.connector import errorcode
import time
HOST = 'localhost'
USER = 'root'
DB = 'clinicdb'
password = 'ZakVezThok888!' #getpass.getpass("Database password for user istreamRead:\n")
conn = mysql.connector.connect(host=HOST, user=USER, passwd=password, database=DB)
#Note for below: resolution width currently excluded, since the dataset was designed specifically where only 16:9 videos were transcoded (at the time of this writing)
df = pd.read_sql('''SELECT table_name FROM information_schema.tables where table_schema = "clinicdb";''', con=conn)
tables = list(df['table_name'])
print()
for t in tables:
print("\\textbf{%s}:" % t.upper().replace("_", "\\_"))
print("\\begin{itemize}")
dft = pd.read_sql('''SELECT * FROM `%s`;''' % t, con=conn)
count = 0
for index, row in dft.iterrows():
print("\\item ", end="")
colcount = 0
for col in list(dft.columns):
s1 = str(row[col]).replace(r"$", r"\$")
s2 = s1.replace(r"_", r"\_")
s3 = s2.replace(r"%", r"\%")
print(s3, end="")
if colcount < len(dft.columns) - 1:
print("; ", end='')
colcount += 1
print()
count += 1
if count == 0:
print("\\item ~")
print(r"~\\\\")
print("\\end{itemize}")
conn.close()