1. Querying relational databases directly with pandas
You have seen that,
2. The pandas way to query
after creating a database engine, you can get the results of any particular line using 4 lines of code: connecting, executing a query, passing the results to a dataframe and naming the columns:
4 lines of code is pretty good but you can do better! You can actually do it in 1 line, utilizing the pandas function read_sql_query and passing it 2 arguments. The first argument will be the query you wish to make, the 2nd argument the engine you want to connect to. And thus you can achieve the same as this code by executing this single line.
The power of pandas! In the following exercises, you'll gain more expertise in writing SQL queries and using pandas to execute them.
3. Let's practice!
What are you waiting for? The end of this video? Let's do it!