def pred(self): if self.cmbcode.currentText() != "Select": cn=db.createconnection() query="select passingratio from overallpassratio where college_code=%s" cursor=cn.cursor() cursor.execute(query,(self.cmbcode.currentText())) totalrow=cursor.fetchall() listpass1=[] for data in totalrow: listpass1.append(data[0]) a=[] b=[] c=[] d=[] e=[] f=[] a.append(listpass1[0]) b.append(listpass1[1]) c.append(listpass1[2]) d.append(listpass1[3]) e.append(listpass1[4]) f.append(listpass1[5]) passarray=np.array([a,b,c,d,e,f]) print(passarray) cn = db.createconnection() query = "select year from overallpassratio where college_code=%s" cursor = cn.cursor() cursor.execute(query, (self.cmbcode.currentText())) totalrow = cursor.fetchall() listyear1 = [] for data in totalrow: listyear1.append(data[0]) aa = [] bb = [] cc = [] dd = [] ee = [] ff = [] aa.append(listyear1[0]) bb.append(listyear1[1]) cc.append(listyear1[2]) dd.append(listyear1[3]) ee.append(listyear1[4]) ff.append(listyear1[5]) yeararray = np.array([aa, bb, cc, dd, ee, ff]) print(yeararray) # X_train,y_train=train_test_split(yeararray,passarray) X_train=yeararray y_train=passarray X_test=[[2019],[2020],[2021],[2022],[2023],[2024]] y_test=[[],[],[],[]] regressor=LinearRegression() regressor.fit(X_train,y_train) y_predictor=regressor.predict(X_test) # plt.scatter(X_test,y_test) plt.plot(X_test,y_predictor) plt.show() else: self.showMessage("Error!! College Code not selected")
def insertrecord(self, name, email, userid, password): con = db.createconnection() query = "insert into manager(Name,Email,UserId,Password) values(%s,%s,%s,%s)" cursor = con.cursor() cursor.execute(query, (name, email, userid, password)) con.commit() self.messagebox("Record Inserted")
def go(self): cn = db.createconnection() self.code = self.cmbcode.currentText() if self.code == "Select": print("jjjjj") self.me = QMessageBox() self.me.setWindowTitle("Sure") self.me.setText("Select any college code") self.me.setIcon(QMessageBox.Information) self.me.exec() else: query = "select college_name,affilation from add_college where college_code=%s" cursor = cn.cursor() cursor.execute(query, (self.code)) totalrows = cursor.fetchall() for data in totalrows: self.txtcollegename.setText(data[0]) self.txtaffiliation.setText(data[1]) # self.name=self.txtcollegename query1 = "select branch from college_details where college_code=%s" cursor1 = cn.cursor() a = cursor1.execute(query1, (self.code)) self.tblbranch.setRowCount(a) totalrow = cursor1.fetchall() for rowno, rowdata in enumerate(totalrow): for colno, coldata in enumerate(rowdata): self.tblbranch.setItem(rowno, colno, QTableWidgetItem(str(coldata)))
def plotchart(self): cn = db.createconnection() code = self.comboBoxcode.currentText() name = self.clgname.text() year = self.comboBoxyear.currentText() query = "select Placed from passratio where college_code=%s && year=%s" cursor = cn.cursor() cursor.execute(query, (code, year)) totalrow = cursor.fetchall() a = [] for data in totalrow: for i in range(len(data)): a.append(int(data[i])) print(a) query1 = "select branch from passratio where college_code=%s && year=%s" cursor1 = cn.cursor() cursor1.execute(query1, (code, year)) totalrow = cursor1.fetchall() b = [] for data in totalrow: for i in range(len(data)): b.append(int(data[i])) plt.plot(b, a, label="Placement vs Branch") plt.xlabel("Branch") plt.ylabel("Placement") plt.legend() plt.show()
def senddata(self): cn = db.createconnection() code = self.cmbcode.currentText() if code == "Select": msg.messagebox("Please select college code") else: branch = self.cmbbranch.currentText() if branch != "Select": clgname = self.lblname.text() year = self.cmbyear.currentText() passs = self.passbox.value() querycheck = "select * from passratio where college_code=%s && branch=%s && year=%s" cursor = cn.cursor() a = cursor.execute(querycheck, (code, branch, year)) if (a): msg.messagebox("This record already exsist") else: query1 = "select total_admission from year_collegedetail where college_code=%s && Branch=%s && year=%s" cursor1 = cn.cursor() cursor1.execute(query1, (code, branch, year)) tota = cursor1.fetchall() for data in tota: a = int(data[0]) passrat = (passs * 100) // a query = "insert into passratio(college_code,college_name,branch,passed,year,passratio) values(%s,%s,%s,%s,%s,%s)" cursor = cn.cursor() cursor.execute( query, (code, clgname, branch, passs, year, passrat)) cn.commit() msg.messagebox("Accepted") else: msg.messagebox("Select any branch")
def plotchart(self): cn = db.createconnection() code = self.cmbcode.currentText() year = self.cmbyear.currentText() query = "select passratio from passratio where college_code=%s && year=%s" cursor = cn.cursor() cursor.execute(query, (code, year)) totalrow = cursor.fetchall() a = [] for data in totalrow: for i in range(len(data)): a.append(int(data[i])) print(a) query1 = "select branch from passratio where college_code=%s && year=%s" cursor1 = cn.cursor() cursor1.execute(query1, (code, year)) totalrow = cursor1.fetchall() b = [] for data in totalrow: for i in range(len(data)): b.append(data[i]) plt.plot(b, a, label="Passing Ratio vs Courses") plt.xlabel("Courses") plt.ylabel("Passing Ratio") plt.legend() plt.show()
def plotchart(self): cn = db.createconnection() code = self.comboBoxid.currentText() name = self.clgName.text() branch = self.comboBoxbranch.currentText() query = "select Placement,Discipline,PassingRatio,Infrastructure from surveyform where College_code=%s" cursor = cn.cursor() cursor.execute(query, (code)) totalrow = cursor.fetchall() a = [] for data in totalrow: for i in range(len(data)): a.append(int(data[i])) print(a) listt = ["placement", "discipline", "passingratio", "Infrastructure"] # query1 = "select Placement,Discipline,PassingRatio,Infrastructure from surveyform where College_code=%s" # cursor1 = cn.cursor() # cursor1.execute(query1, (code, branch)) # totalrow = cursor1.fetchall() # b= [] # for data in totalrow: # for i in range(len(data)): # b.append(int(data[i])) plt.bar(listt, a, label="Passing Ratio vs Year") plt.xlabel("Values") plt.ylabel("Ratings") plt.legend() plt.show()
def senddata(self): cn = db.createconnection() code = self.cmbcode.currentText() if code == "Select": msg.messagebox("Please select college code") else: branch = self.cmbbranch.currentText() if branch == "": msg.messagebox("Please select branch") else: if branch != "Select": clgname = self.lblname.text() year = self.yearbox.value() adm = self.passbox.value() querycheck = "select * from year_collegedetail where college_code=%s && Branch=%s && year=%s" cursor = cn.cursor() a = cursor.execute(querycheck, (code, branch, year)) if (a): msg.messagebox("This record already exsist") else: query = "insert into year_collegedetail(college_code,college_name,Branch,total_admission,year) values(%s,%s,%s,%s,%s)" cursor = cn.cursor() cursor.execute(query, (code, clgname, branch, adm, year)) cn.commit() msg.messagebox("Accepted") else: msg.messagebox("Select any branch")
def populatecombo(self): cn = db.createconnection() query = "select distinct college_code from passratio" cursor = cn.cursor() cursor.execute(query) totalrow = cursor.fetchall() for data in totalrow: self.comboBoxcode.addItems(data)
def populatecode(self): cn = db.createconnection() query = "select college_code from add_college" cursor = cn.cursor() cursor.execute(query) totalrow = cursor.fetchall() for data in totalrow: self.cmbcode.addItems(data)
def populatecollegename(self): cn = db.createconnection() code = self.cmbcode.currentText() query = "select college_name from overallpassratio where college_code=%s" cursor = cn.cursor() cursor.execute(query, (code)) totalrow = cursor.fetchone() for data in totalrow: self.clgname.setText(data)
def populatebranch(self): cn = db.createconnection() self.clgcode = self.collegecodecomboBox.currentText() query = "select branch from college_details where college_code=%s" cursor = cn.cursor() cursor.execute(query, (self.clgcode)) totalrow = cursor.fetchall() for data in totalrow: self.comboBoxCourse.addItems(data)
def populateyear(self): code = self.cmbcode.currentText() cn = db.createconnection() query = "select distinct year from passratio where college_code=%s" cursor = cn.cursor() cursor.execute(query, (code)) totalrow = cursor.fetchall() for data in totalrow: self.cmbyear.addItems(data)
def populatepasscombo(self): cn = db.createconnection() code = self.cmbcode.currentText() query = "select total_admission from year_collegedetail where college_code=%s" cursor = cn.cursor() cursor.execute(query, (code)) totalrow = cursor.fetchone() for data in totalrow: print(data) self.passbox.setMaximum(int(data))
def populatecollegecode(self): cn = db.createconnection() self.clgname = self.comboBoxCollegeName.currentText() query = "select college_code from add_college where college_name=%s" cursor = cn.cursor() cursor.execute(query, (self.clgname)) totalrow = cursor.fetchone() for data in totalrow: self.lineEditCollegeCode.setText(data) self.lineEditCollegeCode.setReadOnly(True)
def populatetable(self): cn=db.createconnection() query="select * from manager" cursor=cn.cursor() a=cursor.execute(query) self.tblmanager.setRowCount(a) totalrow=cursor.fetchall() for rowno,rowdata in enumerate(totalrow): for colno,coldata in enumerate(rowdata): self.tblmanager.setItem(rowno,colno,QTableWidgetItem(str(coldata)))
def populatebranch(self): self.comboBoxbranch.clear() # self.cmbbranch.addItem("Select") #code=self.comboBoxcode.currentText() cn=db.createconnection() query="select distinct branch from passratio where college_code=%s && year=%s" cursor=cn.cursor() cursor.execute(query,(self.clgcode,self.comboBoxyear.currentText())) totalrow=cursor.fetchall() for data in totalrow: self.comboBoxbranch.addItems(data)
def populatecode(self): cn = db.createconnection() self.clgcode = self.comboBoxcode.currentText() query = "select college_name from passratio where college_code=%s" cursor = cn.cursor() cursor.execute(query, (self.clgcode)) totalrow = cursor.fetchone() for data in totalrow: self.clgname.setText(data) self.clgname.setReadOnly(True) self.populatetable()
def populatebranch(self): self.cmbbranch.clear() # self.cmbbranch.addItem("Select") code = self.cmbcode.currentText() cn = db.createconnection() query = "select distinct Branch from year_collegedetail where college_code=%s && year=%s" cursor = cn.cursor() cursor.execute(query, (code, self.cmbyear.currentText())) totalrow = cursor.fetchall() for data in totalrow: self.cmbbranch.addItems(data)
def populatecollegename(self): self.comboBoxCourse.clear() cn = db.createconnection() self.clgname = self.collegecodecomboBox.currentText() query = "select college_name from add_college where college_code=%s" cursor = cn.cursor() cursor.execute(query, (self.clgname)) totalrow = cursor.fetchall() for data in totalrow: self.lineEditCollegeName.setText(data[0]) self.lineEditCollegeName.setReadOnly(True) self.populatebranch()
def populatetable(self): cn = db.createconnection() query = "select year,total_admission from year_collegedetail where college_code=%s && Branch=%s" cursor = cn.cursor() a = cursor.execute(query, (self.collegecodecomboBox.currentText(), self.comboBoxCourse.currentText())) totalrow = cursor.fetchall() print(a) self.tbl.setRowCount((a)) for rowno, rowdata in enumerate(totalrow): for colno, coldata in enumerate(rowdata): self.tbl.setItem(rowno, colno, QTableWidgetItem(str(coldata)))
def populatetable(self): cn = db.createconnection() self.clgcode = self.comboBoxcode.currentText() query = "select branch,year,Placed from passratio where college_code=%s" cursor = cn.cursor() a = cursor.execute(query, (self.clgcode)) self.tableWidget.setRowCount(a) totalrow = cursor.fetchall() for rowno, rowdata in enumerate(totalrow): for colno, coldata in enumerate(rowdata): print("hi" + str(coldata)) self.tableWidget.setItem(rowno, colno, QTableWidgetItem(str(coldata)))
def populatepassing(self): if self.comboBoxyear.currentText()!="Select": cn=db.createconnection() query="select passed from passratio where college_code=%s && branch=%s && year=%s" cursor=cn.cursor() cursor.execute(query,(self.clgcode,self.comboBoxbranch.currentText(),self.comboBoxyear.currentText())) totalrow=cursor.fetchone() if totalrow!=None: for data in totalrow: self.placed.setMaximum(int(data)) else: msg.messagebox("Select year")
def populatecollege(self): # self.cmbbranch.clear() self.cmbyear.clear() cn = db.createconnection() code = self.cmbcode.currentText() query = "select college_name from year_collegedetail where college_code=%s" cursor = cn.cursor() cursor.execute(query, (code)) totalrow = cursor.fetchone() for data in totalrow: self.lblname.setText(data) # self.populatebranch() self.populateyear()
def signin(self): cn = db.createconnection() self.username = self.txtusername.text() self.password = self.txtpass.text() query = "select username,password from adminlogin where username=%s && password=%s" cursor = cn.cursor() a = cursor.execute(query, (self.username, self.password)) cursor.fetchone() if (a): print("okkk") self.showpage() else: m.messagebox("Inccorect details")
def populatecollege(self): cn = db.createconnection() code = self.cmbcode.currentText() query = "select college_name from add_college where college_code=%s" cursor = cn.cursor() cursor.execute(query, (code)) totalrow = cursor.fetchone() for data in totalrow: self.lblname.setText(data) query1 = "select branch from college_details where college_code=%s" cursor1 = cn.cursor() cursor1.execute(query1, (code)) totalrow1 = cursor1.fetchall() for data1 in totalrow1: self.cmbbranch.addItems(data1)
def populatetable(self): cn = db.createconnection() query = "select year,passratio from passratio where college_code=%s && branch=%s" cursor = cn.cursor() a = cursor.execute( query, (self.cmbcode.currentText(), self.cmbbranch.currentText())) if a: self.tbl.setRowCount(a) totalrow = cursor.fetchall() for rowno, rowdata in enumerate(totalrow): for colno, coldata in enumerate(rowdata): self.tbl.setItem(rowno, colno, QTableWidgetItem(str(coldata))) else: msg.messagebox("Record Not Found")
def fetch(self): self.txtuserid.setReadOnly(True) cn = db.createconnection() self.userid = self.txtuserid.text() query = "select Name,Email,Password from manager where UserId=%s" cursor = cn.cursor() a = cursor.execute(query, (self.userid)) totalrows = cursor.fetchall() if (a): for rowdata in totalrows: self.txtname.setText(rowdata[0]) self.txtemail.setText(rowdata[1]) self.txtpassword.setText(rowdata[2]) else: msg.messagebox("Invalid UserId")
def exitdata(self): self.clgname = self.comboBoxCollegeName.currentText() cn = db.createconnection() query = "select branch from college_details where college_name=%s" cursor = cn.cursor() self.a = cursor.execute(query, (self.clgname)) if (self.a < 3): self.message = QMessageBox() self.message.setText("College " + self.clgname + " " + "must have atleast three branches\nAdd more") self.message.setWindowTitle("Check") self.message.setIcon(QMessageBox.Information) self.message.buttonClicked.connect(self.exbtn) b = self.message.exec() else: self.close()
def populatecollege(self): self.comboBoxyear.clear() cn = db.createconnection() code = self.comboBoxcode.currentText() query = "select college_name from add_college where college_code=%s" cursor = cn.cursor() cursor.execute(query, (code)) totalrow = cursor.fetchone() for data in totalrow: self.clgname.setText(data) query1 = "select distinct year from year_collegedetail where college_code=%s" cursor1 = cn.cursor() cursor1.execute(query1, (code)) totalrow1 = cursor1.fetchall() for data1 in totalrow1: self.comboBoxyear.addItems(data1)