Question: In Python using results from mysql how do you perform linear regression and predicted y values? I was able to get the results from SQL

In Python using results from mysql how do you perform linear regression and predicted y values? I was able to get the results from SQL and attempted to turn it in to a list. How should I proceed from here?

This is what I have:

import mysql.connector cnx = mysql.connector.connect(user='', password='', host='', database='') cursor = cnx.cursor() query = ("SELECT timestampdiff(YEAR, bdate, CURDATE()) AS age, salary FROM emp ORDER BY salary WHERE salary > %s " +"and salary < %s") cursor.execute(query, (20000, 55000)) for (bdate, salary) in cursor: print(bdate, salary) rows = cursor.fetchall() result_list = [row for row in rows] print (result_list) cursor.close() cnx.close()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!