From the course: Advanced Analytics Engineering: Real-World Practice

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Solution: Create tests for data with Python

Solution: Create tests for data with Python

(upbeat music) - [Instructor] All right. Here's our solution to this assessment. We use the JSON library. We create a function called get_cold_windy_rainy_days. In that, we then reference our JSON file that has our data. Within that function, we create another one called is_cold_windy_rainy_day, where we create two columns: average temp, which takes the temperature, maximum temperature, minimum, and divides it by two. Then we get the total precipitation by adding snow to precipitation. We use an if statement there to create a Boolean condition, returning true or false. And then lastly, we define blustery_days and return it. If you got this right, great job. If you didn't get it right, that's okay. Keep practicing, you'll get it eventually.

Contents