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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started