def getData(course, col):
    sql = 'select enrollCode, courseId, courseName, description, days, time from classes where courseId=' + course + ';'
    df = executeSQL(sql)
    if col == 'courseIdandTitle':
        return (df['courseId'] + ' - ' + df['courseName'])[0]
    elif col == 'description':
        return (df['description'])[0]
    else:
        return '\n'.join(df[col].tolist())
示例#2
0
def getClassesList(onlineOrInPerson, undergradOrGrad):
    if not onlineOrInPerson:
        onlineOrInPerson = 'In Person'
    if not undergradOrGrad:
        undergradOrGrad = 'Undergrad'
    if isinstance(onlineOrInPerson, list):
        onlineOrInPerson = ','.join(
            [onlineOrInPersonSwitcher[i] for i in onlineOrInPerson])
    else:
        onlineOrInPerson = onlineOrInPersonSwitcher[onlineOrInPerson]
    if isinstance(undergradOrGrad, list):
        undergradOrGrad = ','.join(
            [undergradOrGradSwitcher[i] for i in undergradOrGrad])
    else:
        undergradOrGrad = undergradOrGradSwitcher[undergradOrGrad]

    onlineOrInPerson = '(' + onlineOrInPerson + ')'
    undergradOrGrad = '(' + undergradOrGrad + ')'
    sql = 'select enrollCode, courseId from classes where online in ' + onlineOrInPerson + ' and level in ' + undergradOrGrad + ';'
    df = executeSQL(sql)
    return (df['courseId']).tolist()
示例#3
0
def getStatesList():
    sql = 'select state from vi_states;'
    df = executeSQL(sql)
    return df['state'].tolist()
示例#4
0
def getCountiesList():
    sql = 'select state,county from vi_counties;'
    df = executeSQL(sql)
    return (df['state'] + ":" + df['county']).tolist()
示例#5
0
def getTotals():
    sql = 'select data_date,cases, deaths, cases_diff, deaths_diff, death_rate from us_totals;'
    df = executeSQL(sql)
    return df