Now that we have the data available in a DataFrame, we can walk through how to restrict, sort, and sift through data with a few Python commands. The concepts we are going to walk through using pandas are also common using SQL, so I will also include the equivalent SQL commands for reference.
Restricting
The concept of restricting data, which is also known as filtering data, is all about isolating one or more records based on conditions. Simple examples are when you are only retrieving results based on matching a specific field and value. For example, you only want to see results for one user or a specific point in time. Other requirements for restricting data can be more complicated, including explicit conditions that require elaborate logic, business rules, and multiple steps. I will not be covering complex examples that require complex logic but will add some references in the Further reading section. However...