Testing Python Data Science Code
54mAdvanced2022-09-01
Authors

Miki Tebeka
CEO at 353Solutions
Course details
The larger and more complex the world of data science becomes, the more data there is to collect, sort, clean, model on, and much more. An emerging pain point in this brave new world is that a lot can go wrong if your data engineering and development practices are shoddy. This advanced-level course shows data scientists, Python developers, and data analysts how to test scientific (data science) code written in Python. Veteran data science trainer and consultant Miki Tebeka covers testing techniques, with a focus on issues specific to data science code, such as floating point errors, statistical testing, working with large datasets, choosing a baseline, and more. After presenting a testing overview, Miki dives into testing with pytest and hypothesis. He explains how to use schemas, truth values, approximate testing, and more in data validation. Miki goes over regression testing, then demonstrates how to test Jupyter Notebooks.
Skills covered
PythonProgramming LanguagesOpen SourceSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Testing scientific applications
- 02 - What you should know
- 03 - Setting up
1. Testing Overview
- 04 - Why test
- 05 - Types of tests
- 06 - Challenges in testing scientific applications
- 07 - Continuous integration overview
2. pytest
- 08 - pytest overview
- 09 - Selecting tests
- 10 - Parametrized tests
- 11 - Fixtures
- 12 - Mocking
- 13 - Challenge - Test with pytest
- 14 - Solution - Test with pytest
3. hypothesis
- 15 - Overview of hypothesis
- 16 - Testing with hypothesis
- 17 - NumPy utilities
- 18 - pandas utilities
- 19 - Writing strategies
- 20 - Challenge - Test with hypothesis
- 21 - Solution - Test with hypothesis
4. Data Validation
- 22 - Using schemas
- 23 - Truth values
- 24 - Floating point wonders
- 25 - Approximate testing
- 26 - Dealing with randomness
- 27 - Comparing pandas DataFrames
- 28 - Challenge - Testing numerical code
- 29 - Solution - Testing numerical code
5. Regression Testing
- 30 - Regression testing overview
- 31 - Selecting regression data
- 32 - Choosing quality metrics and baseline
- 33 - Quality regression testing
- 34 - Choosing speed and memory metrics
- 35 - Performance regression testing
6. Testing Jupyter Notebooks
- 36 - Testing Notebooks overview
- 37 - Using nbconvert
- 38 - Refactoring code
- 39 - Other test libraries
Conclusion
- 40 - Next steps
Related courses
- Python Code Challenges for Object-Oriented Programming
- Python Code Challenges: Working with Data
- Python Data Analytics: From Notebooks to Production
- Build with AI: LLM-Powered Data Analysis App with Python and Streamlit
- Python Statistics Essential Training
- Get Ready for Your Coding Interview
- Introduction to Data Science (2019)
- Introduction to Data Science