SlideShare a Scribd company logo
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
➢ 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()
Introduction to map(), filter() and
reduce()
www.edureka.co/python
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
www.edureka.co/python
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
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
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
www.edureka.co/python
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
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
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
www.edureka.co/python
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
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
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
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
www.edureka.co/python
How to use Map() Filter() and Reduce() functions in Python | Edureka
c = map(lambda x:x+x, )filter(lambda x: (x>=3), (1,2,3,4))
www.edureka.co/python
1 2 3 4
3 443
filter(lambda x: (x>=3), (1,2,3,4))
c = map(lambda x:x+x, )
www.edureka.co/python
,( ) )
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.
www.edureka.co/python
c = filter(lambda x: (x>=3), )map(lambda x:x+x, (1,2,3,4))
www.edureka.co/python
c = filter(lambda x: (x>=3), )
map(lambda x:x+x, (1,2,3,4))
2 3 4
5 6 7
1
4
www.edureka.co/python
map(lambda x:x+x, (1,2,3,4))
1 2 3 4
c = filter(lambda x: (x>=3), )4 5 6 7( )), , ,
www.edureka.co/python
www.edureka.co/python
d = reduce ( lambda x, y: x+y, )map ( lambda x:x+x, filter ( lambda x: (x>=3) , (1,2,3,4)))
www.edureka.co/python
d = reduce ( lambda x, y: x+y, )
map ( lambda x:x+x, filter ( lambda x: (x>=3) , (1,2,3,4)))
1 2 3 4
3 443
86
www.edureka.co/python
d = reduce ( lambda x, y: x+y,
)
map ( lambda x:x+x, filter ( lambda x: (x>=3) , (1,2,3,4)))
1 2 3 4
3 443
86( , ))
www.edureka.co/python
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
www.edureka.co/python

More Related Content

What's hot (20)

PPTX
Map, Filter and Reduce In Python
Simplilearn
 
PPTX
Class, object and inheritance in python
Santosh Verma
 
PPTX
Python ppt
Anush verma
 
PPT
9. Input Output in java
Nilesh Dalvi
 
PDF
Python Programming by Dr. C. Sreedhar.pdf
Sreedhar Chowdam
 
PPTX
Python-Classes.pptx
Karudaiyar Ganapathy
 
PDF
Date and Time Module in Python | Edureka
Edureka!
 
PPTX
Python basics
Hoang Nguyen
 
PDF
Python recursion
Prof. Dr. K. Adisesha
 
PDF
Basic Concepts in Python
Sumit Satam
 
PDF
Java I/o streams
Hamid Ghorbani
 
PDF
Python Collections Tutorial | Edureka
Edureka!
 
PDF
Object oriented approach in python programming
Srinivas Narasegouda
 
PDF
Python lambda functions with filter, map & reduce function
ARVIND PANDE
 
PPSX
Modules and packages in python
TMARAGATHAM
 
PPTX
Python 3 Programming Language
Tahani Al-Manie
 
PPTX
PROBLEM SOLVING TECHNIQUES USING PYTHON.pptx
BELMERGLADSONAsstPro
 
PPT
Command line arguments.21
myrajendra
 
PPTX
Python
Sangita Panchal
 
Map, Filter and Reduce In Python
Simplilearn
 
Class, object and inheritance in python
Santosh Verma
 
Python ppt
Anush verma
 
9. Input Output in java
Nilesh Dalvi
 
Python Programming by Dr. C. Sreedhar.pdf
Sreedhar Chowdam
 
Python-Classes.pptx
Karudaiyar Ganapathy
 
Date and Time Module in Python | Edureka
Edureka!
 
Python basics
Hoang Nguyen
 
Python recursion
Prof. Dr. K. Adisesha
 
Basic Concepts in Python
Sumit Satam
 
Java I/o streams
Hamid Ghorbani
 
Python Collections Tutorial | Edureka
Edureka!
 
Object oriented approach in python programming
Srinivas Narasegouda
 
Python lambda functions with filter, map & reduce function
ARVIND PANDE
 
Modules and packages in python
TMARAGATHAM
 
Python 3 Programming Language
Tahani Al-Manie
 
PROBLEM SOLVING TECHNIQUES USING PYTHON.pptx
BELMERGLADSONAsstPro
 
Command line arguments.21
myrajendra
 

Similar to How to use Map() Filter() and Reduce() functions in Python | Edureka (20)

PPTX
Functions in advanced programming
VisnuDharsini
 
PPTX
Lecture 14. Lamda, filter, map, zip.pptx
ikromovavazbek02
 
PDF
advanced python for those who have beginner level experience with python
barmansneha1204
 
PDF
Advanced Python after beginner python for intermediate learners
barmansneha1204
 
PPT
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
PPTX
Map filter reduce in Python
Adnan Siddiqi
 
PPTX
Advance python programming
Jagdish Chavan
 
PDF
Python’s filter() function An Introduction to Iterable Filtering
Inexture Solutions
 
PDF
Porque aprender haskell me fez um programador python melhor?
UFPA
 
PDF
lec14.pdf
projectseasy
 
PPTX
Python overview
Dmitry Zinoviev
 
PPTX
Functional programming in python
Edward D. Weinberger
 
PDF
Functional programming in python
Edward D. Weinberger
 
PDF
Intro to Map Reduce
Doron Vainrub
 
PPTX
Python programming: Anonymous functions, String operations
Megha V
 
PPTX
Python Programming | JNTUA | UNIT 3 | Lists |
FabMinds
 
PDF
Map Reduce
Sri Prasanna
 
PPTX
lambda engineering students machine learnings.pptx
mrsam3062
 
KEY
Programming with Python - Week 3
Ahmet Bulut
 
PPTX
Python advance
Deepak Chandella
 
Functions in advanced programming
VisnuDharsini
 
Lecture 14. Lamda, filter, map, zip.pptx
ikromovavazbek02
 
advanced python for those who have beginner level experience with python
barmansneha1204
 
Advanced Python after beginner python for intermediate learners
barmansneha1204
 
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Map filter reduce in Python
Adnan Siddiqi
 
Advance python programming
Jagdish Chavan
 
Python’s filter() function An Introduction to Iterable Filtering
Inexture Solutions
 
Porque aprender haskell me fez um programador python melhor?
UFPA
 
lec14.pdf
projectseasy
 
Python overview
Dmitry Zinoviev
 
Functional programming in python
Edward D. Weinberger
 
Functional programming in python
Edward D. Weinberger
 
Intro to Map Reduce
Doron Vainrub
 
Python programming: Anonymous functions, String operations
Megha V
 
Python Programming | JNTUA | UNIT 3 | Lists |
FabMinds
 
Map Reduce
Sri Prasanna
 
lambda engineering students machine learnings.pptx
mrsam3062
 
Programming with Python - Week 3
Ahmet Bulut
 
Python advance
Deepak Chandella
 
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
PDF
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
PDF
Tableau Tutorial for Data Science | Edureka
Edureka!
 
PDF
Python Programming Tutorial | Edureka
Edureka!
 
PDF
Top 5 PMP Certifications | Edureka
Edureka!
 
PDF
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
PDF
Linux Mint Tutorial | Edureka
Edureka!
 
PDF
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
PDF
Importance of Digital Marketing | Edureka
Edureka!
 
PDF
RPA in 2020 | Edureka
Edureka!
 
PDF
Email Notifications in Jenkins | Edureka
Edureka!
 
PDF
EA Algorithm in Machine Learning | Edureka
Edureka!
 
PDF
Cognitive AI Tutorial | Edureka
Edureka!
 
PDF
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
PDF
Blue Prism Top Interview Questions | Edureka
Edureka!
 
PDF
Big Data on AWS Tutorial | Edureka
Edureka!
 
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
PDF
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
PDF
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Edureka!
 
Ad

Recently uploaded (20)

PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 

How to use Map() Filter() and Reduce() functions in Python | Edureka

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
  • 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()
  • 3. Introduction to map(), filter() and reduce() www.edureka.co/python
  • 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
  • 20. c = map(lambda x:x+x, )filter(lambda x: (x>=3), (1,2,3,4)) www.edureka.co/python
  • 21. 1 2 3 4 3 443 filter(lambda x: (x>=3), (1,2,3,4)) c = map(lambda x:x+x, ) 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.
  • 24. c = filter(lambda x: (x>=3), )map(lambda x:x+x, (1,2,3,4)) www.edureka.co/python
  • 25. c = filter(lambda x: (x>=3), ) map(lambda x:x+x, (1,2,3,4)) 2 3 4 5 6 7 1 4 www.edureka.co/python
  • 26. map(lambda x:x+x, (1,2,3,4)) 1 2 3 4 c = filter(lambda x: (x>=3), )4 5 6 7( )), , , www.edureka.co/python
  • 28. d = reduce ( lambda x, y: x+y, )map ( lambda x:x+x, filter ( lambda x: (x>=3) , (1,2,3,4))) www.edureka.co/python
  • 29. d = reduce ( lambda x, y: x+y, ) map ( lambda x:x+x, filter ( lambda x: (x>=3) , (1,2,3,4))) 1 2 3 4 3 443 86 www.edureka.co/python
  • 30. d = reduce ( lambda x, y: x+y, ) map ( lambda x:x+x, filter ( lambda x: (x>=3) , (1,2,3,4))) 1 2 3 4 3 443 86( , )) www.edureka.co/python
  • 31. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co