From the course: Testing Python Data Science Code

Unlock this course with a free trial

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

Solution: Testing numerical code

Solution: Testing numerical code - Python Tutorial

From the course: Testing Python Data Science Code

Solution: Testing numerical code

(upbeat music) - [Instructor] Let's have a look at my solution. So I'm importing pandera, and then I'm defining the schema. The time is a column. The type is pretty complicated. It's daytime TZDtype, which is in nanoseconds, and it defaults to UTC. I did it by first loading the data frame, and then poking around the values to see what they are. Next, the metrics. They are strings, and they should be either CPU or memory. And finally, the values are floats, and they should be bigger than zero. And now, I can end the decorator of the check_output to the load_metrics. The rest of the code stays the same. And now, we can run the code. So Run, Run Without Debugging, and we see that the code passes.

Contents