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
Ad

Recommended

Python final ppt
Python final ppt
Ripal Ranpara
 
Python Seminar PPT
Python Seminar PPT
Shivam Gupta
 
Python Lambda Function
Python Lambda Function
Md Soyaib
 
Advanced Python : Decorators
Advanced Python : Decorators
Bhanwar Singh Meena
 
Np cooks theorem
Np cooks theorem
Narayana Galla
 
Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...
Simplilearn
 
Machine Learning
Machine Learning
Girish Khanzode
 
AES.ppt
AES.ppt
BincySam2
 
Map, Filter and Reduce In Python
Map, Filter and Reduce In Python
Simplilearn
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
Chapter 05 classes and objects
Chapter 05 classes and objects
Praveen M Jigajinni
 
Python functions
Python functions
Prof. Dr. K. Adisesha
 
Fundamentals of Python Programming
Fundamentals of Python Programming
Kamal Acharya
 
Introduction to Python
Introduction to Python
amiable_indian
 
Python Generators
Python Generators
Akshar Raaj
 
Python OOPs
Python OOPs
Binay Kumar Ray
 
Packages In Python Tutorial
Packages In Python Tutorial
Simplilearn
 
Python : Functions
Python : Functions
Emertxe Information Technologies Pvt Ltd
 
Polymorphism presentation in java
Polymorphism presentation in java
Ahsan Raja
 
Object oriented programming in python
Object oriented programming in python
baabtra.com - No. 1 supplier of quality freshers
 
File handling in Python
File handling in Python
Megha V
 
Python-Polymorphism.pptx
Python-Polymorphism.pptx
Karudaiyar Ganapathy
 
What is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | Edureka
Edureka!
 
Functions in Python
Functions in Python
Kamal Acharya
 
Java interfaces
Java interfaces
Raja Sekhar
 
Object oriented approach in python programming
Object oriented approach in python programming
Srinivas Narasegouda
 
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Edureka!
 
Function in Python
Function in Python
Yashdev Hada
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
Functions in advanced programming
Functions in advanced programming
VisnuDharsini
 

More Related Content

What's hot (20)

Map, Filter and Reduce In Python
Map, Filter and Reduce In Python
Simplilearn
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
Chapter 05 classes and objects
Chapter 05 classes and objects
Praveen M Jigajinni
 
Python functions
Python functions
Prof. Dr. K. Adisesha
 
Fundamentals of Python Programming
Fundamentals of Python Programming
Kamal Acharya
 
Introduction to Python
Introduction to Python
amiable_indian
 
Python Generators
Python Generators
Akshar Raaj
 
Python OOPs
Python OOPs
Binay Kumar Ray
 
Packages In Python Tutorial
Packages In Python Tutorial
Simplilearn
 
Python : Functions
Python : Functions
Emertxe Information Technologies Pvt Ltd
 
Polymorphism presentation in java
Polymorphism presentation in java
Ahsan Raja
 
Object oriented programming in python
Object oriented programming in python
baabtra.com - No. 1 supplier of quality freshers
 
File handling in Python
File handling in Python
Megha V
 
Python-Polymorphism.pptx
Python-Polymorphism.pptx
Karudaiyar Ganapathy
 
What is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | Edureka
Edureka!
 
Functions in Python
Functions in Python
Kamal Acharya
 
Java interfaces
Java interfaces
Raja Sekhar
 
Object oriented approach in python programming
Object oriented approach in python programming
Srinivas Narasegouda
 
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Edureka!
 
Function in Python
Function in Python
Yashdev Hada
 
Map, Filter and Reduce In Python
Map, Filter and Reduce In Python
Simplilearn
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
Fundamentals of Python Programming
Fundamentals of Python Programming
Kamal Acharya
 
Introduction to Python
Introduction to Python
amiable_indian
 
Python Generators
Python Generators
Akshar Raaj
 
Packages In Python Tutorial
Packages In Python Tutorial
Simplilearn
 
Polymorphism presentation in java
Polymorphism presentation in java
Ahsan Raja
 
File handling in Python
File handling in Python
Megha V
 
What is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | Edureka
Edureka!
 
Object oriented approach in python programming
Object oriented approach in python programming
Srinivas Narasegouda
 
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Exception Handling In Python | Exceptions In Python | Python Programming Tuto...
Edureka!
 
Function in Python
Function in Python
Yashdev Hada
 

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

TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
Functions in advanced programming
Functions in advanced programming
VisnuDharsini
 
purrr.pdf
purrr.pdf
Mateus S. Xavier
 
4 R Tutorial DPLYR Apply Function
4 R Tutorial DPLYR Apply Function
Sakthi Dasans
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Spark workshop
Spark workshop
Wojciech Pituła
 
Functional Programming
Functional Programming
Olexandra Dmytrenko
 
Java 8 lambda expressions
Java 8 lambda expressions
Logan Chien
 
Function in Python.pptx by Faculty at gla university in mathura uttar pradesh
Function in Python.pptx by Faculty at gla university in mathura uttar pradesh
bloodskullgoswami
 
Why Haskell Matters
Why Haskell Matters
romanandreg
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
Calvin Cheng
 
Scala. Introduction to FP. Monads
Scala. Introduction to FP. Monads
Kirill Kozlov
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)
riue
 
Frp2016 3
Frp2016 3
Kirill Kozlov
 
R Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdf
Timothy McBush Hiele
 
Composition birds-and-recursion
Composition birds-and-recursion
David Atchley
 
Practical cats
Practical cats
Raymond Tay
 
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
Tomohiro Kumagai
 
Differential calculus
Differential calculus
Santhanam Krishnan
 
Modular Module Systems
Modular Module Systems
league
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
Functions in advanced programming
Functions in advanced programming
VisnuDharsini
 
4 R Tutorial DPLYR Apply Function
4 R Tutorial DPLYR Apply Function
Sakthi Dasans
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Java 8 lambda expressions
Java 8 lambda expressions
Logan Chien
 
Function in Python.pptx by Faculty at gla university in mathura uttar pradesh
Function in Python.pptx by Faculty at gla university in mathura uttar pradesh
bloodskullgoswami
 
Why Haskell Matters
Why Haskell Matters
romanandreg
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
Calvin Cheng
 
Scala. Introduction to FP. Monads
Scala. Introduction to FP. Monads
Kirill Kozlov
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)
riue
 
R Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdf
Timothy McBush Hiele
 
Composition birds-and-recursion
Composition birds-and-recursion
David Atchley
 
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
Swift 3.0 で変わったところ - 厳選 13 項目 #love_swift #cswift
Tomohiro Kumagai
 
Modular Module Systems
Modular Module Systems
league
 
Ad

More from Edureka! (20)

What 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 | Edureka
Edureka!
 
Top 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 | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux 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| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
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 | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction 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 | Edureka
Edureka!
 
Top 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 | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux 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| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
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 | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 
Ad

Recently uploaded (20)

FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 

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