+ 5

[Solved] Confusion about a machine learning project.

My team has decided to work on a Product recommendation system for final year project. I've searched for different algorithms to use and everything but I am confused about how I would get the data/dataset for the same. if I'm not wrong we use a csv/xls file for machine learning. But in my case the data would be saved in a database (most probably sql with phpmyadmin as we'll be making a website for displaying products). So how could I get data from it or would I have to convert it to CSV everytime? Also if this is not possible with phpmyadmin, what database is preferable (A website told me about Apache Cassandra) I'm totally new to machine learning so maybe this is a very basic question.

27th Feb 2021, 4:45 AM
$hardul B
$hardul B - avatar
4 Answers
+ 2
HOW TO READ FROM A DATABASE TO A DATAFRAME ________________________________ from sqlalchemy import create_engine import pymysql import pandas as pd sqlEngine = create_engine(‘mysql+pymysql://root:<root here>’); dbConnection = sqlEngine.connect() df = pd.read_sql(“select * from <tablename>”, dbConnection); dbConnection.close() ________________________________ so you imort libraries, set up your engine, connect, read to the dataframe then close your connection. I really recommend you take this course on Udemy. Data Science Course 2021: Complete Data Science Bootcamp https://www.udemy.com/share/101WeAAEcYdlhWQ3oJ/ it will have a section that covers everything you need to know to start using databases in machine learning
5th Mar 2021, 6:42 AM
Ethan
Ethan - avatar
+ 2
Greetings. MySQL is the database and phpmyadmin is just a management tool. If you use MySQL, you will select your data with SQL statements that filter and sort your results. Then your program will display the data, etc. But more likely you should use Pandas. Pandas give you SQL like features but read CSV files and store all the data in Python data structures. Then you won’t need MySQL or anything else. Just CSV files. These could be quite large and still work well. You only need MySQL if the data is too massive or complex.
27th Feb 2021, 11:43 PM
Jerry Hobby
Jerry Hobby - avatar
+ 1
Jerry Hobby I will be making a website and connecting it to the database, hence I had mentioned SQL with Phpmyadmin.(I don't know if I could directly store data inside a CSV file) Pandas is a data manipulation and analysis library from what I read.. But again for analysis I would need data which would be stored in SQL in my case. So how do I utilize that data in Pandas that's what I wanted to know..
1st Mar 2021, 4:51 AM
$hardul B
$hardul B - avatar
- 1
Ethan Gallup Thanks, I think that's exactly what I needed... 👍
5th Mar 2021, 7:14 AM
$hardul B
$hardul B - avatar