Translating SQL WHERE clauses
Many pandas users will have a background processing data directly from databases using the ubiquitous Structured Query Language (SQL). SQL is a standardized language to define, manipulate, and control data stored in a database. The SELECT
statement is the most common way to use SQL to select, filter, aggregate, and order data. Pandas has the ability to connect to databases and send SQL statements to them.
Note
SQL is a very important language to know for data scientists. Much of the world's data is stored in databases that necessitate SQL to retrieve, manipulate, and perform analyses on. SQL syntax is fairly simple and easy to learn. There are many different SQL implementations from companies such as Oracle, Microsoft, IBM, and more. Although the syntax is not compatible between the different implementations, the core of it will look very much the same.
Getting ready
Within a SQL SELECT statement, the WHERE clause is very common and filters data. This recipe will...