1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Data Pipelines

Exercise

Validating a data pipeline with assert and isinstance

To build unit tests for data pipelines, it's important to get familiar with the assert keyword, and the isinstance() function. In this exercise, you'll practice using these two tools to validate components of a data pipeline.

The functions extract() and transform() have been made available for you, along with pandas, which has been imported as pd. Both extract() and transform() return a DataFrame. Good luck!

Instructions 1/4

undefined XP
  • 1
    • Assert that the clean_tax_data DataFrame has five columns.
  • 2
    • Validate that the object stored in the clean_tax_data variable is an instance of a pd.DataFrame.
  • 3
    • Assert that the value stored in the clean_tax_data variable is an instance of pd.DataFrame.
  • 4
    • Try asserting that clean_tax_data takes the type str, and observe the exception.