Answer the question
In order to leave comments, you need to log in
How to connect pandas directly to db instead of feeding csv?
Good day!
Please tell me the code, how to connect with either pandas to fetch data from a table?
I figured out csv, it's not difficult, but what about the database? There is not much data, but you need to see the statistics
Thank you
Answer the question
In order to leave comments, you need to log in
con = pymysql.connect(
host='sql_host', port=sql_port,
user=sql_username, passwd=sql_password,
db=sql_database,
)
df=pd.read_sql_query(sql, con)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question