Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

suggest a range of work sample exercises and design them

Answered: 1 week ago

Question

8. Measure the effectiveness of the succession planning process.

Answered: 1 week ago