SlideShare a Scribd company logo
1 of 10
Mapping Data Types In Python
SlideMake.com
Introduction to Mapping Data Types in Python
Mapping data types in Python allow us to
store data in key-value pairs.
The most common mapping data type in
Python is the dictionary.
Mapping data types are mutable, meaning
their values can be changed.
Working with Dictionaries
Dictionaries are created using curly braces
{} or the dict() constructor.
Keys in a dictionary must be unique and
immutable, such as strings or numbers.
Values in a dictionary can be of any data
type and can be accessed using their
corresponding keys.
Basic Operations with Dictionaries
Accessing values in a dictionary is done by
using the key inside square brackets [].
We can add new key-value pairs to a
dictionary by assigning a value to a new
key.
To remove a key-value pair from a
dictionary, we can use the del keyword
followed by the key.
Common Methods for Dictionaries
The len() function returns the number of
key-value pairs in a dictionary.
The keys() method returns a list of all keys
in the dictionary.
The values() method returns a list of all
values in the dictionary.
Dictionary Comprehension
Dictionary comprehension allows us to
create dictionaries in a concise way.
We can use a loop to iterate over a
sequence and create key-value pairs.
It follows the format {key_expression:
value_expression for item in sequence}.
Other Mapping Data Types
Besides dictionaries, Python also provides
other mapping data types like OrderedDict
and Counter.
OrderedDict is a dictionary subclass that
remembers the order in which key-value
pairs were added.
Counter is a dictionary subclass that counts
the number of occurrences of each element
in a sequence.
Immutable Mapping Data Types
In addition to mutable mapping data types,
Python also offers immutable ones like
frozenset.
A frozenset is an immutable version of the
set data type and can be used as a key in a
dictionary.
Immutable mapping data types are useful
when we need to ensure that the keys
won't change.
Summary
Mapping data types in Python store data in
key-value pairs and are mutable.
Dictionaries are the most common mapping
data type and support various operations
and methods.
Other mapping data types like OrderedDict
and Counter provide additional
functionality.
References
Python Documentation: Mapping Types
dict. Available at:
https://docs.python.org/3/library/stdtypes.ht
ml#dict.
Python Documentation: Dictionary
Comprehension. Available at:
https://docs.python.org/3/tutorial/datastruct
ures.html#dictionaries.

More Related Content

Similar to Mapping Data Types In Python.pptx

Python Dictionary.pptx
Python Dictionary.pptxPython Dictionary.pptx
Python Dictionary.pptxSanad Bhowmik
 
Python For Data Science.pptx
Python For Data Science.pptxPython For Data Science.pptx
Python For Data Science.pptxrohithprabhas1
 
L5 - Data Types, Keywords.pptx
L5 - Data Types, Keywords.pptxL5 - Data Types, Keywords.pptx
L5 - Data Types, Keywords.pptxEloAOgardo
 
L6 - Loops.pptx
L6 - Loops.pptxL6 - Loops.pptx
L6 - Loops.pptxEloAOgardo
 
L6 - Loops.pptx
L6 - Loops.pptxL6 - Loops.pptx
L6 - Loops.pptxEloAOgardo
 
Python for Everybody - Solution Challenge 2021
Python for Everybody - Solution Challenge 2021Python for Everybody - Solution Challenge 2021
Python for Everybody - Solution Challenge 2021AshwinRaj57
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.pptjaba kumar
 
PF 2- Data Types and Veriables (1).pptx
PF 2- Data Types and Veriables (1).pptxPF 2- Data Types and Veriables (1).pptx
PF 2- Data Types and Veriables (1).pptxMuhammadMuzaib1
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning ParrotAI
 
Keywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.netKeywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.netJaya Kumari
 
NEC PPT ET IN CS BY SUBHRAT TRIPATHI.pptx
NEC PPT ET IN CS BY SUBHRAT TRIPATHI.pptxNEC PPT ET IN CS BY SUBHRAT TRIPATHI.pptx
NEC PPT ET IN CS BY SUBHRAT TRIPATHI.pptx0901EO211056SUBHRATT
 
Python Revision Tour 1 and 2 computer . Pptx
Python Revision Tour 1 and 2 computer . PptxPython Revision Tour 1 and 2 computer . Pptx
Python Revision Tour 1 and 2 computer . PptxAniketKhan
 
Python Interview Questions For Freshers
Python Interview Questions For FreshersPython Interview Questions For Freshers
Python Interview Questions For Fresherszynofustechnology
 
Programming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESProgramming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESRushikesh Kolhe
 

Similar to Mapping Data Types In Python.pptx (20)

Chapter - 2.pptx
Chapter - 2.pptxChapter - 2.pptx
Chapter - 2.pptx
 
Python 3.x quick syntax guide
Python 3.x quick syntax guidePython 3.x quick syntax guide
Python 3.x quick syntax guide
 
Python Dictionary.pptx
Python Dictionary.pptxPython Dictionary.pptx
Python Dictionary.pptx
 
Python For Data Science.pptx
Python For Data Science.pptxPython For Data Science.pptx
Python For Data Science.pptx
 
L5 - Data Types, Keywords.pptx
L5 - Data Types, Keywords.pptxL5 - Data Types, Keywords.pptx
L5 - Data Types, Keywords.pptx
 
L6 - Loops.pptx
L6 - Loops.pptxL6 - Loops.pptx
L6 - Loops.pptx
 
L6 - Loops.pptx
L6 - Loops.pptxL6 - Loops.pptx
L6 - Loops.pptx
 
Phython presentation
Phython presentationPhython presentation
Phython presentation
 
AI_2nd Lab.pptx
AI_2nd Lab.pptxAI_2nd Lab.pptx
AI_2nd Lab.pptx
 
Python for Everybody - Solution Challenge 2021
Python for Everybody - Solution Challenge 2021Python for Everybody - Solution Challenge 2021
Python for Everybody - Solution Challenge 2021
 
Data Structures.pdf
Data Structures.pdfData Structures.pdf
Data Structures.pdf
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
 
PF 2- Data Types and Veriables (1).pptx
PF 2- Data Types and Veriables (1).pptxPF 2- Data Types and Veriables (1).pptx
PF 2- Data Types and Veriables (1).pptx
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
 
Keywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.netKeywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.net
 
NEC PPT ET IN CS BY SUBHRAT TRIPATHI.pptx
NEC PPT ET IN CS BY SUBHRAT TRIPATHI.pptxNEC PPT ET IN CS BY SUBHRAT TRIPATHI.pptx
NEC PPT ET IN CS BY SUBHRAT TRIPATHI.pptx
 
Python Revision Tour 1 and 2 computer . Pptx
Python Revision Tour 1 and 2 computer . PptxPython Revision Tour 1 and 2 computer . Pptx
Python Revision Tour 1 and 2 computer . Pptx
 
Python Interview Questions For Freshers
Python Interview Questions For FreshersPython Interview Questions For Freshers
Python Interview Questions For Freshers
 
Programming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESProgramming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTES
 

Recently uploaded

Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 

Recently uploaded (20)

Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 

Mapping Data Types In Python.pptx

  • 1. Mapping Data Types In Python SlideMake.com
  • 2. Introduction to Mapping Data Types in Python Mapping data types in Python allow us to store data in key-value pairs. The most common mapping data type in Python is the dictionary. Mapping data types are mutable, meaning their values can be changed.
  • 3. Working with Dictionaries Dictionaries are created using curly braces {} or the dict() constructor. Keys in a dictionary must be unique and immutable, such as strings or numbers. Values in a dictionary can be of any data type and can be accessed using their corresponding keys.
  • 4. Basic Operations with Dictionaries Accessing values in a dictionary is done by using the key inside square brackets []. We can add new key-value pairs to a dictionary by assigning a value to a new key. To remove a key-value pair from a dictionary, we can use the del keyword followed by the key.
  • 5. Common Methods for Dictionaries The len() function returns the number of key-value pairs in a dictionary. The keys() method returns a list of all keys in the dictionary. The values() method returns a list of all values in the dictionary.
  • 6. Dictionary Comprehension Dictionary comprehension allows us to create dictionaries in a concise way. We can use a loop to iterate over a sequence and create key-value pairs. It follows the format {key_expression: value_expression for item in sequence}.
  • 7. Other Mapping Data Types Besides dictionaries, Python also provides other mapping data types like OrderedDict and Counter. OrderedDict is a dictionary subclass that remembers the order in which key-value pairs were added. Counter is a dictionary subclass that counts the number of occurrences of each element in a sequence.
  • 8. Immutable Mapping Data Types In addition to mutable mapping data types, Python also offers immutable ones like frozenset. A frozenset is an immutable version of the set data type and can be used as a key in a dictionary. Immutable mapping data types are useful when we need to ensure that the keys won't change.
  • 9. Summary Mapping data types in Python store data in key-value pairs and are mutable. Dictionaries are the most common mapping data type and support various operations and methods. Other mapping data types like OrderedDict and Counter provide additional functionality.
  • 10. References Python Documentation: Mapping Types dict. Available at: https://docs.python.org/3/library/stdtypes.ht ml#dict. Python Documentation: Dictionary Comprehension. Available at: https://docs.python.org/3/tutorial/datastruct ures.html#dictionaries.

Editor's Notes

  1. Image source: https://sohail18.hashnode.dev/data-types-in-python-2
  2. Image source: https://gandenberger.org/2018/03/10/ordered-dicts-vs-ordereddict/
  3. Image source: https://www.slideserve.com/cwen/12-python-dictionary-powerpoint-ppt-presentation
  4. Image source: https://exceljet.net/functions/len-function
  5. Image source: https://www.pinterest.com/pin/56365432825305677/
  6. Image source: http://www.pythonpandas.com/python-data-types/
  7. Image source: https://www.slideserve.com/learnbay_datascience/mutable-data-types-in-python
  8. Image source: https://www.riset.guru.pubiway.com/data-types-in-python-with-example-codedec/