From the course: Advanced Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Transforms

Transforms - Python Tutorial

From the course: Advanced Python

Start my 1-month free trial

Transforms

- Python has become pretty popular among data scientists and other developers who need to work with large amounts of data and that's not an accident. The Python standard library provides built-in functions for transforming sequences of data. And you should use these whenever you find you have a need for that kind of operation. So in this example, we'll take a look at some of those functions. So here in VS code, I have opened the file transforms_start.py in my built-in functions chapter. And I'll try out the filter function first. The filter functions does essentially what its name implies. It creates an iterator that filters out values from a given sequence. You pass it a function to perform a Boolean test and if that test returns false, then that item is removed from the resulting sequence. So I have a list of numbers here in my editor right here at nums. And let's suppose I'd like to filter out the even numbers. So first, I'll write the code to call the filter function and I'll name…

Contents