Beispiel #1
0
def listClassesSession3():
    global computerThirdYearRecord
    global currentYear

    currentClass = excelToDF.convertExcelToDataframe(
        "./classesDatabases/Computer_Engineering_Year3.xlsx")
    random = rng.generateRandom(15, len(currentClass))
    computerThirdYearRecord = excelToDF.returnRandomStdDF(currentClass, random)
    randomStudentList = excelToDF.randomStdList(currentClass, random)
    currentYear = "Year3"
    return render_template(
        "listStudentsRandom.html",
        today=today,
        currentClass=randomStudentList,
        year="Year3",
        selectedStudents=excelToDF.returnIndex(currentClass))
Beispiel #2
0
# ----------------Libraries-To-Be-Imported-------------------------
import pandas as pd
from scripts import randomNumberGenerator as rng
# import randomNumberGenerator as rng
'''
randomNumberGenerator is imported twice. The first instance on Line[3]
and this is for external scripts. The second on Line[4] which for testing
within the found in which this script is found
'''
# ----------------Libraries-To-Be-Imported-------------------------


# Generating random numbers for the students
m = rng.generateRandom(15, 30)
# print(m)

def convertExcelToDataframe(xlsxFileDirectory: str):
    '''
    xlsxFileDirectory - This is the directory for the excel spreadsheet
    containing the students record

    convertExcelToDataframe() - takes the directory of the excel spreadsheet
    as input and returns a pandas dataframe
    '''
    xlsx_file = pd.ExcelFile(xlsxFileDirectory)
    df = xlsx_file.parse(xlsx_file.sheet_names[0])
    return df

def randomStdList(dataframe, random):
    '''
    dataframe - pandas dataframe which contains the names, index numbers