31. Comparison with SQL
Comparison with SQL
Since many potential pandas users have some familiarity with SQL, this page is meant to provide some examples of how various SQL operations would be performed using pandas.
If you’re new to pandas, you might want to first read through 10 Minutes to pandas to familiarize yourself with the library.
As is customary, we import pandas and numpy as follows:
In [1]: import pandas as pd In [2]: import numpy as np
Most of the examples will utilize the tips
dataset found within pandas tests. We’ll read the data into a DataFrame called tips
and assume we have a database table of the same name and structure.
In [3]: url