Excel and SQL Notes
read_excel needs openpyxl and read_sql needs a connection. SQLite works out of the box.
Example
import sqlite3
con = sqlite3.connect(":memory:")
pd.DataFrame({"id": [1, 2], "n": ["a", "b"]}).to_sql("t", con, index=False)
print(pd.read_sql("select * from t where id > 1", con))Result
id n 0 2 b
Exercise
Read from a database.
pd.("select 1", con)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.