1. Learn
  2. /
  3. Courses
  4. /
  5. Streamlined Data Ingestion with pandas

Connected

Exercise

Joining and filtering

Just as you might not always want all the data in a single table, you might not want all columns and rows that result from a JOIN. In this exercise, you'll use SQL to refine a data import.

Weather exacerbates some housing problems more than others. Your task is to focus on water leak reports in hpd311calls and assemble a dataset that includes the day's precipitation levels from weather to see if there is any relationship between the two. The provided SQL gets all columns in hpd311calls, but you'll need to modify it to get the necessary weather column and filter rows with a WHERE clause.

pandas is loaded as pd, and the database engine, engine, has been created.

Instructions 1/2

undefined XP
    1
    2
  • Complete query to get the prcp column in weather and join weather to hpd311calls on their date and created_date columns, respectively.
  • Use read_sql() to load the results of the query into the leak_calls dataframe.