Using SQL and Python Together#

Many times, we have large datasets that we want to manipulate and explore in SQL. However, SQL isn’t able to do some of the more powerful analyses, such as text analysis, network analysis, machine learning, and more. In order to do this, we need to bring the data into Python. In this chapter, we’ll go over some code to use an SQL query to bring in a table from a relational database into a pandas DataFrame.

Note that in all of the notebooks in this chapter, we’ll be doing everything within Python, so all of the kernels should be Python kernels.