SlideShare une entreprise Scribd logo
1  sur  28
Python Library
and Modules
A library is a collection of modules. It is a reusable
chunk of code that you may want to include in
your programs/projects.
pyttsx3
wikipedia
Pandas
Nampy
Some python
libraries are:-
Numpy is considered as one of the most popular
machine learning library in Python. Array interface is
the best and the most important feature of Numpy. This
interface can be utilized for expressing images, sound
waves, and other binary raw streams as an array of real
numbers in N-dimensional.
import numpy as np
arr = np.array([1, 2, 3, 4, 5])
print(arr)
print(type(arr))
Output- [1 2 3 4 5]
<class 'numpy.ndarray'>
Example 1-
import numpy as np
arr = np.array([[1, 2, 3], [4, 5, 6]])
print(arr)
Output- [[1 2 3]
[4 5 6]]
Example 2-
Pandas is a Python library used for working with data
sets. It has functions for analyzing, cleaning, exploring,
and manipulating data. Its allows us to analyze big
data and make conclusions based on statistical
theories. It can clean messy data sets, and make them
readable and relevant.
import pandas as pd
data = {'Name':[' Janny ', 'Amit',’Suji‘]
'Age':[28,34,29,42]}
df = pd.DataFrame(data)
print df
Its output is as follows −
Age Name
0 28 Janny
1 34 Amit
2 29 Suji
Example1
pyttsx3 is a text-to-speech conversion library in Python.
Unlike alternative libraries, it works offline.
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
Wikipedia is a Python library that makes it easy to
access and parse data from Wikipedia. Search
Wikipedia, get article summaries, get data like links
and images from a page, and more.
Example1
import wikipedia
# finding result for the search
# sentences = 2 refers to numbers of line
result = wikipedia.summary("India", sentences = 2)
# printing the result
print(result)
A python module can be defined as a python
program file which contains a python code
including python functions, class, or variables.
In other words, we can say that our python
code file saved with the extension (.py) is
treated as the module.
Python Modules
Some Python Modules are:-
datetime
1
webbrowser
2
OS
3
Tkinter
4
random
5
The datetime module supplies classes for
manipulating dates and times. The datetime module
has many methods to return information about the
date object.
datetime
import datetime
x = datetime.datetime.now()
print(x.year)
print(x.strftime("%A"))
Output-2021
Sunday
15
Example- Return the year and name of weekday
The webbrowser module includes functions to open
URLs in interactive browser applications. The module
includes a registry of available browsers, in case
multiple options are available on the system. It can also
be controlled with the BROWSER environment variable.
webbrowser
import webbrowser
webbrowser.open('http://docs.python.org/lib/module-webbrowser.html')
Example-
To open a page in the browser, we use
open() function.
The OS module in Python provides functions for
interacting with the operating system. OS comes under
Python’s standard utility modules. This module provides
a portable way of using operating system-dependent
functionality.
OS
1. os.remove() - os.remove() method in Python is used to
remove or delete a file path. This method can not remove
or delete a directory.
2. os.mkdir() - os.mkdir() method in Python is used to create
a directory named path with the specified numeric mode.
The *os* and *os.path* modules include many
functions to interact with the file system. Some
functions are-
3. os.listdir()- os.listdir() method in Python is
used to get the list of all files and
directories in the specified directory. If we
don’t specify any directory, then list of files
and directories in the current working
directory will be returned.
Tkinter is a graphical user interface (GUI) module
for Python, you can make desktop apps with Python
and can develop GUI applications like calculator,
login system, text editor, etc.
Tkinter
Tkinter provides various controls, such as buttons,
labels and text boxes used in a GUI application.
These controls are commonly called widgets.
Tkinter Widgets
Important method of Tkinter
This method is used to start the application.
The mainloop() function is an infinite loop which is used to
run the application, it will wait for an event to
occur and process the event as long as the window is not
closed.
2. The mainloop() Function:-
This method is mainly used to create the main window.
1. Tk(screenName=None, baseName=None, className='Tk', useTk=1) :-
Random
The random module is a built-in module to
generate the pseudo random variables. It can
be used to perform some action randomly
such as to get a random number, selecting a
random elements from a list, shuffle elements
randomly, etc.
Method of Random
seed()- It initialize the random number generator.
getstate()- It returns the current internal state of
the random number generator.
setstate()- It restores the internal state of the
random number generator.
Method of Random
choices()- It returns a list with a element from the
given sequence.
randint()- It returns a random number between the
given range.
For more presentation
contact us
raginijain0208@gmail.com
Python Libraries and Modules

Contenu connexe

Tendances (20)

List,tuple,dictionary
List,tuple,dictionaryList,tuple,dictionary
List,tuple,dictionary
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
 
Python variables and data types.pptx
Python variables and data types.pptxPython variables and data types.pptx
Python variables and data types.pptx
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
 
Data Analysis and Visualization using Python
Data Analysis and Visualization using PythonData Analysis and Visualization using Python
Data Analysis and Visualization using Python
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
 
Python programming : Strings
Python programming : StringsPython programming : Strings
Python programming : Strings
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 
Introduction to matplotlib
Introduction to matplotlibIntroduction to matplotlib
Introduction to matplotlib
 
NUMPY
NUMPY NUMPY
NUMPY
 
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning LibrariesPython - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning Libraries
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPy
 
NumPy
NumPyNumPy
NumPy
 
Python : Data Types
Python : Data TypesPython : Data Types
Python : Data Types
 
Python Seaborn Data Visualization
Python Seaborn Data Visualization Python Seaborn Data Visualization
Python Seaborn Data Visualization
 
Python exception handling
Python   exception handlingPython   exception handling
Python exception handling
 
Python pandas Library
Python pandas LibraryPython pandas Library
Python pandas Library
 
Python Basics
Python BasicsPython Basics
Python Basics
 

Similaire à Python Libraries and Modules

pythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docxpythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docxRameshMishra84
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python ProgrammingDozie Agbo
 
Python-Libraries,Numpy,Pandas,Matplotlib.pptx
Python-Libraries,Numpy,Pandas,Matplotlib.pptxPython-Libraries,Numpy,Pandas,Matplotlib.pptx
Python-Libraries,Numpy,Pandas,Matplotlib.pptxanushya2915
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3FabMinds
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on pythonShubham Yadav
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - englishJen Yee Hong
 
James Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonJames Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonCP-Union
 
Interview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdfInterview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdfExaminationSectionMR
 
unit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptxunit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptxusvirat1805
 
Standard Libraries in Python Programming
Standard Libraries in Python ProgrammingStandard Libraries in Python Programming
Standard Libraries in Python ProgrammingRohan Chougule
 
FDP-faculty deveopmemt program on python
FDP-faculty deveopmemt program on pythonFDP-faculty deveopmemt program on python
FDP-faculty deveopmemt program on pythonkannikadg
 
Using Python Libraries.pdf
Using Python Libraries.pdfUsing Python Libraries.pdf
Using Python Libraries.pdfSoumyadityaDey
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk PemulaOon Arfiandwi
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experiencedzynofustechnology
 
Functions_in_Python.pptx
Functions_in_Python.pptxFunctions_in_Python.pptx
Functions_in_Python.pptxkrushnaraj1
 

Similaire à Python Libraries and Modules (20)

pythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docxpythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docx
 
ch 2. Python module
ch 2. Python module ch 2. Python module
ch 2. Python module
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
 
Python-Libraries,Numpy,Pandas,Matplotlib.pptx
Python-Libraries,Numpy,Pandas,Matplotlib.pptxPython-Libraries,Numpy,Pandas,Matplotlib.pptx
Python-Libraries,Numpy,Pandas,Matplotlib.pptx
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3
 
PyCon Estonia 2019
PyCon Estonia 2019PyCon Estonia 2019
PyCon Estonia 2019
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on python
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english
 
James Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonJames Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on Python
 
Interview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdfInterview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdf
 
unit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptxunit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptx
 
Standard Libraries in Python Programming
Standard Libraries in Python ProgrammingStandard Libraries in Python Programming
Standard Libraries in Python Programming
 
FDP-faculty deveopmemt program on python
FDP-faculty deveopmemt program on pythonFDP-faculty deveopmemt program on python
FDP-faculty deveopmemt program on python
 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
 
Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
Using Python Libraries.pdf
Using Python Libraries.pdfUsing Python Libraries.pdf
Using Python Libraries.pdf
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
 
Functions_in_Python.pptx
Functions_in_Python.pptxFunctions_in_Python.pptx
Functions_in_Python.pptx
 
Python
Python Python
Python
 

Plus de RaginiJain21

Jump statment in python
Jump statment in pythonJump statment in python
Jump statment in pythonRaginiJain21
 
Looping statement in python
Looping statement in pythonLooping statement in python
Looping statement in pythonRaginiJain21
 
Conditionalstatement
ConditionalstatementConditionalstatement
ConditionalstatementRaginiJain21
 
Python media library
Python media libraryPython media library
Python media libraryRaginiJain21
 
Basic python programs
Basic python programsBasic python programs
Basic python programsRaginiJain21
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on pythonRaginiJain21
 

Plus de RaginiJain21 (7)

Jump statment in python
Jump statment in pythonJump statment in python
Jump statment in python
 
Looping statement in python
Looping statement in pythonLooping statement in python
Looping statement in python
 
Conditionalstatement
ConditionalstatementConditionalstatement
Conditionalstatement
 
Python media library
Python media libraryPython media library
Python media library
 
Basic python programs
Basic python programsBasic python programs
Basic python programs
 
Python second ppt
Python second pptPython second ppt
Python second ppt
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on python
 

Dernier

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 

Dernier (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 

Python Libraries and Modules

  • 2. A library is a collection of modules. It is a reusable chunk of code that you may want to include in your programs/projects.
  • 4. Numpy is considered as one of the most popular machine learning library in Python. Array interface is the best and the most important feature of Numpy. This interface can be utilized for expressing images, sound waves, and other binary raw streams as an array of real numbers in N-dimensional.
  • 5. import numpy as np arr = np.array([1, 2, 3, 4, 5]) print(arr) print(type(arr)) Output- [1 2 3 4 5] <class 'numpy.ndarray'> Example 1-
  • 6. import numpy as np arr = np.array([[1, 2, 3], [4, 5, 6]]) print(arr) Output- [[1 2 3] [4 5 6]] Example 2-
  • 7. Pandas is a Python library used for working with data sets. It has functions for analyzing, cleaning, exploring, and manipulating data. Its allows us to analyze big data and make conclusions based on statistical theories. It can clean messy data sets, and make them readable and relevant.
  • 8. import pandas as pd data = {'Name':[' Janny ', 'Amit',’Suji‘] 'Age':[28,34,29,42]} df = pd.DataFrame(data) print df Its output is as follows − Age Name 0 28 Janny 1 34 Amit 2 29 Suji Example1
  • 9. pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline. import pyttsx3 engine = pyttsx3.init() engine.say("I will speak this text") engine.runAndWait()
  • 10. Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia. Search Wikipedia, get article summaries, get data like links and images from a page, and more.
  • 11. Example1 import wikipedia # finding result for the search # sentences = 2 refers to numbers of line result = wikipedia.summary("India", sentences = 2) # printing the result print(result)
  • 12. A python module can be defined as a python program file which contains a python code including python functions, class, or variables. In other words, we can say that our python code file saved with the extension (.py) is treated as the module. Python Modules
  • 13. Some Python Modules are:- datetime 1 webbrowser 2 OS 3 Tkinter 4 random 5
  • 14. The datetime module supplies classes for manipulating dates and times. The datetime module has many methods to return information about the date object. datetime
  • 15. import datetime x = datetime.datetime.now() print(x.year) print(x.strftime("%A")) Output-2021 Sunday 15 Example- Return the year and name of weekday
  • 16. The webbrowser module includes functions to open URLs in interactive browser applications. The module includes a registry of available browsers, in case multiple options are available on the system. It can also be controlled with the BROWSER environment variable. webbrowser
  • 18. The OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system-dependent functionality. OS
  • 19. 1. os.remove() - os.remove() method in Python is used to remove or delete a file path. This method can not remove or delete a directory. 2. os.mkdir() - os.mkdir() method in Python is used to create a directory named path with the specified numeric mode. The *os* and *os.path* modules include many functions to interact with the file system. Some functions are-
  • 20. 3. os.listdir()- os.listdir() method in Python is used to get the list of all files and directories in the specified directory. If we don’t specify any directory, then list of files and directories in the current working directory will be returned.
  • 21. Tkinter is a graphical user interface (GUI) module for Python, you can make desktop apps with Python and can develop GUI applications like calculator, login system, text editor, etc. Tkinter
  • 22. Tkinter provides various controls, such as buttons, labels and text boxes used in a GUI application. These controls are commonly called widgets. Tkinter Widgets
  • 23. Important method of Tkinter This method is used to start the application. The mainloop() function is an infinite loop which is used to run the application, it will wait for an event to occur and process the event as long as the window is not closed. 2. The mainloop() Function:- This method is mainly used to create the main window. 1. Tk(screenName=None, baseName=None, className='Tk', useTk=1) :-
  • 24. Random The random module is a built-in module to generate the pseudo random variables. It can be used to perform some action randomly such as to get a random number, selecting a random elements from a list, shuffle elements randomly, etc.
  • 25. Method of Random seed()- It initialize the random number generator. getstate()- It returns the current internal state of the random number generator. setstate()- It restores the internal state of the random number generator.
  • 26. Method of Random choices()- It returns a list with a element from the given sequence. randint()- It returns a random number between the given range.
  • 27. For more presentation contact us raginijain0208@gmail.com