Youtube Link: https://youtu.be/QxpbE5hDPws
** Python Certification Training: https://www.edureka.co/data-science-python-certification-course**
This Edureka PPT on 'map, filter, and reduce functions in Python' is to educate you about these very important built-in functions in Python. Below are the topics covered in this PPT:
Introduction to map filter reduce
The map() function
The filter() function
The reduce() function
Using map(),filter() and reduce() functions together
filter() within map()
map() within filter()
map() and filter() within reduce()
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
2. ➢ Introduction to map() filter() reduce()
▪ The map() function
▪ The filter() function
▪ The reduce() function
➢ Using map() filter() and reduce() together
www.edureka.co/python
▪ filter() within map()
▪ map() within filter()
▪ filter() and map() within reduce()
4. Applies a given
function to all the
iterables and returns
a new list
Creates an output list
consisting of values for
which the function
returns true
Applies a given
function to the
iterables and returns a
single value
map() filter() reduce()
Introduction to map(), filter() and reduce()
www.edureka.co/python
6. 1 2 3 4
map():
Applies a given function to all the iterables and returns a
new list.
output = map(lambda x: x+3 , [1,2,3,4])
www.edureka.co/python
7. 1 2 3 4
map():
Applies a given function to all the iterables and returns a
new list.
output = map(lambda x: x+3 , [1,2,3,4])
www.edureka.co/python
8. 1 2 3 4
4 5 6 7
map():
Applies a given function to all the iterables and returns a
new list.
output = map(lambda x: x+3 , [1,2,3,4])
www.edureka.co/python
10. filter()
Used to filter the given iterables(lists, sets, etc) with the help
of another function passed as an argument to test all the
elements to be true or false.
output = map(lambda x: (x>=3) , [1,2,3,4])
1 2 3 4
www.edureka.co/python
11. filter()
Used to filter the given iterables(lists, sets, etc) with the help
of another function passed as an argument to test all the
elements to be true or false.
output = map(lambda x: (x>=3) , [1,2,3,4])
1 2 3 4
www.edureka.co/python
12. filter()
Used to filter the given iterables(lists, sets, etc) with the help
of another function passed as an argument to test all the
elements to be true or false.
output = map(lambda x: (x>=3) , [1,2,3,4])
1 2 3 4
3 4
www.edureka.co/python
14. output = map(lambda x,y: x+y, [1,2,3,4])
reduce():
Applies some other function to a list of elements that are
passed as a parameter to it and finally returns a single
value.
1 2 3 4
15. output = map(lambda x,y: x+y, [1,2,3,4])
reduce():
Applies some other function to a list of elements that are
passed as a parameter to it and finally returns a single
value.
1 2 3 4
3
www.edureka.co/python
16. output = map(lambda x,y: x+y, [1,2,3,4])
reduce():
Applies some other function to a list of elements that are
passed as a parameter to it and finally returns a single
value.
1 2 3 4
3
6
www.edureka.co/python
17. output = map(lambda x,y: x+y, [1,2,3,4])
reduce():
Applies some other function to a list of elements that are
passed as a parameter to it and finally returns a single
value.
1 2 3 4
3
6
10
www.edureka.co/python
22. ,( ) )
1 2 3 4
3 4
43c = map(lambda x:x+x,
filter(lambda x: (x>=3), (1,2,3,4))
www.edureka.co/python
Filters out integers >=3 resulting in [3,4], then maps this using (x+x)
condition, you will get [6,8], which is the output.