read database pandas
from sqlalchemy import create_engine
engine = create_engine("sqlite:///data.db")
query = """
SELECT *
FROM weather;
"""
weather = pd.read_sql(query, engine)
read database pandas
from sqlalchemy import create_engine
engine = create_engine("sqlite:///data.db")
query = """
SELECT *
FROM weather;
"""
weather = pd.read_sql(query, engine)
working with mysql database in pandas
Importing data from a MySQL database into a Pandas data frame including column names:-
import mysql.connector as sql.
import pandas as pd.
db_connection = sql.connect(host='hostname', database='db_name', user='username', password='password')
db_cursor = db_connection.cursor()
db_cursor.execute('SELECT * FROM table_name')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us