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)

Map, Filter and Reduce In Python
Map, Filter and Reduce In PythonMap, Filter and Reduce In Python
Map, Filter and Reduce In Python
Simplilearn
 
Python : Functions
Python : FunctionsPython : Functions
Python : Functions
Emertxe Information Technologies Pvt Ltd
 
Python functions
Python functionsPython functions
Python functions
Prof. Dr. K. Adisesha
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
TMARAGATHAM
 
Functions in python
Functions in pythonFunctions in python
Functions in python
colorsof
 
Dictionaries in Python
Dictionaries in PythonDictionaries in Python
Dictionaries in Python
baabtra.com - No. 1 supplier of quality freshers
 
C functions
C functionsC functions
C functions
University of Potsdam
 
What is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | EdurekaWhat is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | Edureka
Edureka!
 
Iterarators and generators in python
Iterarators and generators in pythonIterarators and generators in python
Iterarators and generators in python
Sarfaraz Ghanta
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
Devashish Kumar
 
This pointer
This pointerThis pointer
This pointer
Kamal Acharya
 
Function in c
Function in cFunction in c
Function in c
Raj Tandukar
 
Main method in java
Main method in javaMain method in java
Main method in java
Hitesh Kumar
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in Python
MSB Academy
 
Map filter reduce in Python
Map filter reduce in PythonMap filter reduce in Python
Map filter reduce in Python
Adnan Siddiqi
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
Mohammed Sikander
 
Interface in java
Interface in javaInterface in java
Interface in java
PhD Research Scholar
 
Namespaces
NamespacesNamespaces
Namespaces
Sangeetha S
 
Python programming
Python  programmingPython  programming
Python programming
Ashwin Kumar Ramasamy
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
amiable_indian
 

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

Functions in advanced programming
Functions in advanced programmingFunctions in advanced programming
Functions in advanced programming
VisnuDharsini
 
Lecture 14. Lamda, filter, map, zip.pptx
Lecture 14. Lamda, filter, map, zip.pptxLecture 14. Lamda, filter, map, zip.pptx
Lecture 14. Lamda, filter, map, zip.pptx
ikromovavazbek02
 
advanced python for those who have beginner level experience with python
advanced python for those who have beginner level experience with pythonadvanced python for those who have beginner level experience with python
advanced python for those who have beginner level experience with python
barmansneha1204
 
Advanced Python after beginner python for intermediate learners
Advanced Python after beginner python for intermediate learnersAdvanced Python after beginner python for intermediate learners
Advanced Python after beginner python for intermediate learners
barmansneha1204
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Advance python programming
Advance python programming Advance python programming
Advance python programming
Jagdish Chavan
 
Python’s filter() function An Introduction to Iterable Filtering
Python’s filter() function An Introduction to Iterable FilteringPython’s filter() function An Introduction to Iterable Filtering
Python’s filter() function An Introduction to Iterable Filtering
Inexture Solutions
 
Porque aprender haskell me fez um programador python melhor?
Porque aprender haskell me fez um programador python melhor?Porque aprender haskell me fez um programador python melhor?
Porque aprender haskell me fez um programador python melhor?
UFPA
 
lec14.pdf
lec14.pdflec14.pdf
lec14.pdf
projectseasy
 
Python overview
Python overviewPython overview
Python overview
Dmitry Zinoviev
 
Functional programming in python
Functional programming in pythonFunctional programming in python
Functional programming in python
Edward D. Weinberger
 
Functional programming in python
Functional programming in pythonFunctional programming in python
Functional programming in python
Edward D. Weinberger
 
Intro to Map Reduce
Intro to Map ReduceIntro to Map Reduce
Intro to Map Reduce
Doron Vainrub
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operations
Megha V
 
Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists | Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists |
FabMinds
 
Map Reduce
Map ReduceMap Reduce
Map Reduce
Sri Prasanna
 
lambda engineering students machine learnings.pptx
lambda engineering students machine learnings.pptxlambda engineering students machine learnings.pptx
lambda engineering students machine learnings.pptx
mrsam3062
 
Programming with Python - Week 3
Programming with Python - Week 3Programming with Python - Week 3
Programming with Python - Week 3
Ahmet Bulut
 
Python advance
Python advancePython advance
Python advance
Deepak Chandella
 
Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014
Reuven Lerner
 
Functions in advanced programming
Functions in advanced programmingFunctions in advanced programming
Functions in advanced programming
VisnuDharsini
 
Lecture 14. Lamda, filter, map, zip.pptx
Lecture 14. Lamda, filter, map, zip.pptxLecture 14. Lamda, filter, map, zip.pptx
Lecture 14. Lamda, filter, map, zip.pptx
ikromovavazbek02
 
advanced python for those who have beginner level experience with python
advanced python for those who have beginner level experience with pythonadvanced python for those who have beginner level experience with python
advanced python for those who have beginner level experience with python
barmansneha1204
 
Advanced Python after beginner python for intermediate learners
Advanced Python after beginner python for intermediate learnersAdvanced Python after beginner python for intermediate learners
Advanced Python after beginner python for intermediate learners
barmansneha1204
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Advance python programming
Advance python programming Advance python programming
Advance python programming
Jagdish Chavan
 
Python’s filter() function An Introduction to Iterable Filtering
Python’s filter() function An Introduction to Iterable FilteringPython’s filter() function An Introduction to Iterable Filtering
Python’s filter() function An Introduction to Iterable Filtering
Inexture Solutions
 
Porque aprender haskell me fez um programador python melhor?
Porque aprender haskell me fez um programador python melhor?Porque aprender haskell me fez um programador python melhor?
Porque aprender haskell me fez um programador python melhor?
UFPA
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operations
Megha V
 
Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists | Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists |
FabMinds
 
lambda engineering students machine learnings.pptx
lambda engineering students machine learnings.pptxlambda engineering students machine learnings.pptx
lambda engineering students machine learnings.pptx
mrsam3062
 
Programming with Python - Week 3
Programming with Python - Week 3Programming with Python - Week 3
Programming with Python - Week 3
Ahmet Bulut
 
Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014
Reuven Lerner
 
Ad

More from Edureka! (20)

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

Recently uploaded (20)

Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
GIS and FME: The Foundation to Improve the Locate Process of Utilities
GIS and FME: The Foundation to Improve the Locate Process of UtilitiesGIS and FME: The Foundation to Improve the Locate Process of Utilities
GIS and FME: The Foundation to Improve the Locate Process of Utilities
Safe Software
 
DevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical PodcastDevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical Podcast
Chris Wahl
 
FME Beyond Data Processing Creating A Dartboard Accuracy App
FME Beyond Data Processing Creating A Dartboard Accuracy AppFME Beyond Data Processing Creating A Dartboard Accuracy App
FME Beyond Data Processing Creating A Dartboard Accuracy App
Safe Software
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Dancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptxDancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptx
Elliott Richmond
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Data Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any ApplicationData Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any Application
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
GIS and FME: The Foundation to Improve the Locate Process of Utilities
GIS and FME: The Foundation to Improve the Locate Process of UtilitiesGIS and FME: The Foundation to Improve the Locate Process of Utilities
GIS and FME: The Foundation to Improve the Locate Process of Utilities
Safe Software
 
DevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical PodcastDevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical Podcast
Chris Wahl
 
FME Beyond Data Processing Creating A Dartboard Accuracy App
FME Beyond Data Processing Creating A Dartboard Accuracy AppFME Beyond Data Processing Creating A Dartboard Accuracy App
FME Beyond Data Processing Creating A Dartboard Accuracy App
Safe Software
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Dancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptxDancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptx
Elliott Richmond
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Data Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any ApplicationData Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any Application
Safe Software
 

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