SlideShare a Scribd company logo
1 of 24
Python for Data Science
(Introduction to Data Visualization)
Dr.M.Rajendiran
Dept. of Computer Science and Engineering
Panimalar Engineering College
Install Python 3 On Ubuntu
Prerequisites
Step 1.A system running Ubuntu
Step 2.A user account with sudo privileges
Step 3.Access to a terminal command-line (Ctrl–Alt–T)
Step 4.Make sure your environment is configured to use
Python 3.8
2
Install Python 3
Now you can start the installation of Python 3.8.
$sudo apt install python3.8
Allow the process to complete and verify the Python
version was installed successfully
$python ––version
3
Installing and using Python on Windows is very simple.
Step 1: Download the Python Installer binaries
Step 2: Run the Executable Installer
Step 3: Add Python to environmental variables
Step 4: Verify the Python Installation
4
Python Installation
Open the Python website in your web browser.
https://www.python.org/downloads/windows/
Once the installer is downloaded, run the Python installer.
Add the following path
C:Program FilesPython37-32: for 64-bit installation
Once the installation is over, you will see a Python Setup
Successful window.
You are ready to start developing Python applications in
your Windows 10 system.
5
iPython Installation
If you already have Python installed, you can use pip to
install iPython using the following command:
$pip install iPython
To use it, type the following command in your computer’s
terminal:
$ipython
6
Data Visualization
 A picture is worth a million words.
 Data visualization plays an essential role in the representation of
both small and large data.
 Data visualization is the graphical representation of data in order to
interactively and efficiently understanding to clients and customers.
 Data visualization enable us to extract information, better
understand the data, and make more effective decisions.
 One of the key role of data scientist is the ability to tell a compelling
story, visualizing data and findings in an approachable and
motivating way.
Data Visualization
 With a tiny domain knowledge, data visualizations can be used to
express and demonstrate key relationships in plots and charts.
There are five key basic data visualization.
1. Line Plot
2. Bar Chart
3. Histogram Plot
4. Box and Whisker Plot
5. Scatter Plot
Data Visualization
Matplotlib
 Matplotlib is one of the most popular python library packages used
for data visualization.
 It is numerical mathematics extension NumPy.
 It provides an object-oriented programming for embedding plots into
applications.
 It uses general-purpose graphic tools like Tkinter, wxpython, etc.,
 It can be used in Python and IPython, Jupyterlab and
Jupyternotebook.
Data Visualization
 We will learn how to create a line plot with matplotlib.
 The following example creates a sequence of floating point values
as the x-axis and a sine wave as a function of the x-axis as the
observations on the y-axis.
 The outputs are plotted as a line plot.
 The pyplot module from matplotlib package is imported with an alias
pyplot.
from matplotlib import pyplot
 We need an array of numbers to plot. NumPy library which is
imported with the sin alias.
from numpy import sin
Data Visualization
 The drawings of line plot can be shown by calling the show()
function.
pyplot.show()
 The line plot can be saved to file using savefig() function.
pyplot.savefig('my_image.png')
 Line plots are useful for presenting time series data as well as any
order data.
 A line plot is used to present observations collected at consistent
intervals.
 A line plot can be created by calling the plot() function.
 The complete program is as follows:
Data Visualization
 *
Data Visualization
Bar chart
 A bar chart or graph that presents categorical data with rectangular
bars with heights proportional to the values.
 The bars can be plotted vertically or horizontally.
 A bar graph shows comparisons among distinct categories.
 One axis represent categories and other axis represent value.
 Matplotlib provides the bar() function that can be used in the python.
Syntax: bar(x, height, width, bottom, align)
x: sequence of scalar
height: The height of the bars
width: The width of the bars
bottom: The coordinates of the bars bases.
align: Alignment of the bars to the x coordinates.
Data Visualization
Data Visualization
Histograms
 A histogram is a graphical illustration that organizes a group of data
points into user-specified ranges.
 In a histogram, it is the area of the bar that shows the frequency of
occurrences for each bin.
 A Histogram has two axes that is x axis and y axis.
 The x axis represent event whose frequency you have to count.
 The y axis represent frequency.
 The different heights of bar show different frequency of occurrence
of data.
 Histograms uses in image processing, brightness, equalize an
image and computer vision.
Data Visualization
A histogram plot can be created by calling the hist() function and
passing in a list or array.
pyplot.hist(x)
The following parameters for a histogram:
x : array or sequence of arrays
bins : integer or sequence or optional
Example:
Consider a semester examination result that we have to make a
histogram graph of your results, showing the overall frequency of
occurrence of grade in class.
marks=(45,54,65,56,74,47,87,78,98,89,100,72,58,28,44,49,71,80)
Data Visualization
Data Visualization
Box and Whisker Plot
A boxplot is generally used to summarize the distribution of a data
sample, also called box and whisker plot
A set of data containing the minimum, first quartile, median, third
quartile, and maximum.
In a box plot, we draw a box from the first quartile to the third
quartile.
Vertical line goes through the box at the median.
The whiskers go from each quartile to the minimum or maximum.
The x-axis is used to represent the data sample and y-axis
represents the observation values.
Data Visualization
Example:
We use the numpy.random.normal() function to create the
data for boxplots.
It has three parameters such as mean and standard deviation
and number of values.
Boxplots can be drawn by calling the boxplot() function.
pyplot.boxplot(x)
Data Visualization
Data Visualization
Scatter Plot
 A scatterplot is a graphic tool used to display the relationship
between two quantitative variables.
 A scatterplot consists of an X axis, a Y axis and a series of dots.
 Scatter plots can be created by calling the scatter() function.
pyplot.scatter(x, y)
Scatter plots are useful for showing the association between two
variables.
The example below creates two data samples such as marks of
boys and girls in two different colours.
Data Visualization
Conclusion
 Python is great as a programming language
 It is great for data science.
There are many visualization libraries:
Matplotlib
seaborn
bokesh
holoviews
datashader
folium
yt
 email:mrajen@rediffmail.com
.

More Related Content

What's hot

GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
 
Dev Concepts: Data Structures and Algorithms
Dev Concepts: Data Structures and AlgorithmsDev Concepts: Data Structures and Algorithms
Dev Concepts: Data Structures and AlgorithmsSvetlin Nakov
 
16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks QueuesIntro C# Book
 
Python iteration
Python iterationPython iteration
Python iterationdietbuddha
 
Ch02 primitive-data-definite-loops
Ch02 primitive-data-definite-loopsCh02 primitive-data-definite-loops
Ch02 primitive-data-definite-loopsJames Brotsos
 
Control statements-Computer programming
Control statements-Computer programmingControl statements-Computer programming
Control statements-Computer programmingnmahi96
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c languagetanmaymodi4
 
02. Primitive Data Types and Variables
02. Primitive Data Types and Variables02. Primitive Data Types and Variables
02. Primitive Data Types and VariablesIntro C# Book
 
Arrays-Computer programming
Arrays-Computer programmingArrays-Computer programming
Arrays-Computer programmingnmahi96
 
List,tuple,dictionary
List,tuple,dictionaryList,tuple,dictionary
List,tuple,dictionarynitamhaske
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayimtiazalijoono
 
Computer notes - Expression Tree
Computer notes - Expression TreeComputer notes - Expression Tree
Computer notes - Expression Treeecomputernotes
 
Binary expression tree
Binary expression treeBinary expression tree
Binary expression treeShab Bi
 
Chapter 22. Lambda Expressions and LINQ
Chapter 22. Lambda Expressions and LINQChapter 22. Lambda Expressions and LINQ
Chapter 22. Lambda Expressions and LINQIntro C# Book
 

What's hot (19)

GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
Dev Concepts: Data Structures and Algorithms
Dev Concepts: Data Structures and AlgorithmsDev Concepts: Data Structures and Algorithms
Dev Concepts: Data Structures and Algorithms
 
16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues16. Arrays Lists Stacks Queues
16. Arrays Lists Stacks Queues
 
C# Arrays
C# ArraysC# Arrays
C# Arrays
 
Arrays in C language
Arrays in C languageArrays in C language
Arrays in C language
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
Embedded C - Day 2
 
Python iteration
Python iterationPython iteration
Python iteration
 
Ch02 primitive-data-definite-loops
Ch02 primitive-data-definite-loopsCh02 primitive-data-definite-loops
Ch02 primitive-data-definite-loops
 
Control statements-Computer programming
Control statements-Computer programmingControl statements-Computer programming
Control statements-Computer programming
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
 
02. Primitive Data Types and Variables
02. Primitive Data Types and Variables02. Primitive Data Types and Variables
02. Primitive Data Types and Variables
 
Arrays-Computer programming
Arrays-Computer programmingArrays-Computer programming
Arrays-Computer programming
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
 
List,tuple,dictionary
List,tuple,dictionaryList,tuple,dictionary
List,tuple,dictionary
 
Arrays C#
Arrays C#Arrays C#
Arrays C#
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
Computer notes - Expression Tree
Computer notes - Expression TreeComputer notes - Expression Tree
Computer notes - Expression Tree
 
Binary expression tree
Binary expression treeBinary expression tree
Binary expression tree
 
Chapter 22. Lambda Expressions and LINQ
Chapter 22. Lambda Expressions and LINQChapter 22. Lambda Expressions and LINQ
Chapter 22. Lambda Expressions and LINQ
 

Similar to Python for Data Science

20MEMECH Part 3- Classification.pdf
20MEMECH Part 3- Classification.pdf20MEMECH Part 3- Classification.pdf
20MEMECH Part 3- Classification.pdfMariaKhan905189
 
Introduction to matplotlib
Introduction to matplotlibIntroduction to matplotlib
Introduction to matplotlibPiyush rai
 
Introduction to Pylab and Matploitlib.
Introduction to Pylab and Matploitlib. Introduction to Pylab and Matploitlib.
Introduction to Pylab and Matploitlib. yazad dumasia
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxjovannyflex
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxjovannyflex
 
Visualization and Matplotlib using Python.pptx
Visualization and Matplotlib using Python.pptxVisualization and Matplotlib using Python.pptx
Visualization and Matplotlib using Python.pptxSharmilaMore5
 
The Role of Histograms in Exploring Data Insights
The Role of Histograms in Exploring Data InsightsThe Role of Histograms in Exploring Data Insights
The Role of Histograms in Exploring Data InsightsCIToolkit
 
Data visualization using py plot part i
Data visualization using py plot part iData visualization using py plot part i
Data visualization using py plot part iTutorialAICSIP
 
Graph Tea: Simulating Tool for Graph Theory & Algorithms
Graph Tea: Simulating Tool for Graph Theory & AlgorithmsGraph Tea: Simulating Tool for Graph Theory & Algorithms
Graph Tea: Simulating Tool for Graph Theory & AlgorithmsIJMTST Journal
 
Python-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptxPython-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptxSandeep Singh
 
Python for Data Analysis.pdf
Python for Data Analysis.pdfPython for Data Analysis.pdf
Python for Data Analysis.pdfJulioRecaldeLara1
 
Python-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptxPython-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptxtangadhurai
 
PPT on Data Science Using Python
PPT on Data Science Using PythonPPT on Data Science Using Python
PPT on Data Science Using PythonNishantKumar1179
 

Similar to Python for Data Science (20)

12-IP.pdf
12-IP.pdf12-IP.pdf
12-IP.pdf
 
20MEMECH Part 3- Classification.pdf
20MEMECH Part 3- Classification.pdf20MEMECH Part 3- Classification.pdf
20MEMECH Part 3- Classification.pdf
 
Introduction to matplotlib
Introduction to matplotlibIntroduction to matplotlib
Introduction to matplotlib
 
Introduction to Pylab and Matploitlib.
Introduction to Pylab and Matploitlib. Introduction to Pylab and Matploitlib.
Introduction to Pylab and Matploitlib.
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
 
Visualization and Matplotlib using Python.pptx
Visualization and Matplotlib using Python.pptxVisualization and Matplotlib using Python.pptx
Visualization and Matplotlib using Python.pptx
 
The Role of Histograms in Exploring Data Insights
The Role of Histograms in Exploring Data InsightsThe Role of Histograms in Exploring Data Insights
The Role of Histograms in Exploring Data Insights
 
Data visualization using py plot part i
Data visualization using py plot part iData visualization using py plot part i
Data visualization using py plot part i
 
Python for data analysis
Python for data analysisPython for data analysis
Python for data analysis
 
Graph Tea: Simulating Tool for Graph Theory & Algorithms
Graph Tea: Simulating Tool for Graph Theory & AlgorithmsGraph Tea: Simulating Tool for Graph Theory & Algorithms
Graph Tea: Simulating Tool for Graph Theory & Algorithms
 
Python-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptxPython-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptx
 
Python for Data Analysis.pdf
Python for Data Analysis.pdfPython for Data Analysis.pdf
Python for Data Analysis.pdf
 
Python-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptxPython-for-Data-Analysis.pptx
Python-for-Data-Analysis.pptx
 
Chapter04.pptx
Chapter04.pptxChapter04.pptx
Chapter04.pptx
 
Objects and Graphics
Objects and GraphicsObjects and Graphics
Objects and Graphics
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
PPT on Data Science Using Python
PPT on Data Science Using PythonPPT on Data Science Using Python
PPT on Data Science Using Python
 
Python basics
Python basicsPython basics
Python basics
 
Project
ProjectProject
Project
 

More from Panimalar Engineering College (6)

Python for Beginners(v1)
Python for Beginners(v1)Python for Beginners(v1)
Python for Beginners(v1)
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
 
Cellular Networks
Cellular NetworksCellular Networks
Cellular Networks
 
Wireless Networks
Wireless NetworksWireless Networks
Wireless Networks
 
Wireless Networks
Wireless NetworksWireless Networks
Wireless Networks
 
Multiplexing,LAN Cabling,Routers,Core and Distribution Networks
Multiplexing,LAN Cabling,Routers,Core and Distribution NetworksMultiplexing,LAN Cabling,Routers,Core and Distribution Networks
Multiplexing,LAN Cabling,Routers,Core and Distribution Networks
 

Recently uploaded

Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 

Recently uploaded (20)

Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 

Python for Data Science

  • 1. Python for Data Science (Introduction to Data Visualization) Dr.M.Rajendiran Dept. of Computer Science and Engineering Panimalar Engineering College
  • 2. Install Python 3 On Ubuntu Prerequisites Step 1.A system running Ubuntu Step 2.A user account with sudo privileges Step 3.Access to a terminal command-line (Ctrl–Alt–T) Step 4.Make sure your environment is configured to use Python 3.8 2
  • 3. Install Python 3 Now you can start the installation of Python 3.8. $sudo apt install python3.8 Allow the process to complete and verify the Python version was installed successfully $python ––version 3
  • 4. Installing and using Python on Windows is very simple. Step 1: Download the Python Installer binaries Step 2: Run the Executable Installer Step 3: Add Python to environmental variables Step 4: Verify the Python Installation 4
  • 5. Python Installation Open the Python website in your web browser. https://www.python.org/downloads/windows/ Once the installer is downloaded, run the Python installer. Add the following path C:Program FilesPython37-32: for 64-bit installation Once the installation is over, you will see a Python Setup Successful window. You are ready to start developing Python applications in your Windows 10 system. 5
  • 6. iPython Installation If you already have Python installed, you can use pip to install iPython using the following command: $pip install iPython To use it, type the following command in your computer’s terminal: $ipython 6
  • 7. Data Visualization  A picture is worth a million words.  Data visualization plays an essential role in the representation of both small and large data.  Data visualization is the graphical representation of data in order to interactively and efficiently understanding to clients and customers.  Data visualization enable us to extract information, better understand the data, and make more effective decisions.  One of the key role of data scientist is the ability to tell a compelling story, visualizing data and findings in an approachable and motivating way.
  • 8. Data Visualization  With a tiny domain knowledge, data visualizations can be used to express and demonstrate key relationships in plots and charts. There are five key basic data visualization. 1. Line Plot 2. Bar Chart 3. Histogram Plot 4. Box and Whisker Plot 5. Scatter Plot
  • 9. Data Visualization Matplotlib  Matplotlib is one of the most popular python library packages used for data visualization.  It is numerical mathematics extension NumPy.  It provides an object-oriented programming for embedding plots into applications.  It uses general-purpose graphic tools like Tkinter, wxpython, etc.,  It can be used in Python and IPython, Jupyterlab and Jupyternotebook.
  • 10. Data Visualization  We will learn how to create a line plot with matplotlib.  The following example creates a sequence of floating point values as the x-axis and a sine wave as a function of the x-axis as the observations on the y-axis.  The outputs are plotted as a line plot.  The pyplot module from matplotlib package is imported with an alias pyplot. from matplotlib import pyplot  We need an array of numbers to plot. NumPy library which is imported with the sin alias. from numpy import sin
  • 11. Data Visualization  The drawings of line plot can be shown by calling the show() function. pyplot.show()  The line plot can be saved to file using savefig() function. pyplot.savefig('my_image.png')  Line plots are useful for presenting time series data as well as any order data.  A line plot is used to present observations collected at consistent intervals.  A line plot can be created by calling the plot() function.  The complete program is as follows:
  • 13. Data Visualization Bar chart  A bar chart or graph that presents categorical data with rectangular bars with heights proportional to the values.  The bars can be plotted vertically or horizontally.  A bar graph shows comparisons among distinct categories.  One axis represent categories and other axis represent value.  Matplotlib provides the bar() function that can be used in the python. Syntax: bar(x, height, width, bottom, align) x: sequence of scalar height: The height of the bars width: The width of the bars bottom: The coordinates of the bars bases. align: Alignment of the bars to the x coordinates.
  • 15. Data Visualization Histograms  A histogram is a graphical illustration that organizes a group of data points into user-specified ranges.  In a histogram, it is the area of the bar that shows the frequency of occurrences for each bin.  A Histogram has two axes that is x axis and y axis.  The x axis represent event whose frequency you have to count.  The y axis represent frequency.  The different heights of bar show different frequency of occurrence of data.  Histograms uses in image processing, brightness, equalize an image and computer vision.
  • 16. Data Visualization A histogram plot can be created by calling the hist() function and passing in a list or array. pyplot.hist(x) The following parameters for a histogram: x : array or sequence of arrays bins : integer or sequence or optional Example: Consider a semester examination result that we have to make a histogram graph of your results, showing the overall frequency of occurrence of grade in class. marks=(45,54,65,56,74,47,87,78,98,89,100,72,58,28,44,49,71,80)
  • 18. Data Visualization Box and Whisker Plot A boxplot is generally used to summarize the distribution of a data sample, also called box and whisker plot A set of data containing the minimum, first quartile, median, third quartile, and maximum. In a box plot, we draw a box from the first quartile to the third quartile. Vertical line goes through the box at the median. The whiskers go from each quartile to the minimum or maximum. The x-axis is used to represent the data sample and y-axis represents the observation values.
  • 19. Data Visualization Example: We use the numpy.random.normal() function to create the data for boxplots. It has three parameters such as mean and standard deviation and number of values. Boxplots can be drawn by calling the boxplot() function. pyplot.boxplot(x)
  • 21. Data Visualization Scatter Plot  A scatterplot is a graphic tool used to display the relationship between two quantitative variables.  A scatterplot consists of an X axis, a Y axis and a series of dots.  Scatter plots can be created by calling the scatter() function. pyplot.scatter(x, y) Scatter plots are useful for showing the association between two variables. The example below creates two data samples such as marks of boys and girls in two different colours.
  • 23. Conclusion  Python is great as a programming language  It is great for data science. There are many visualization libraries: Matplotlib seaborn bokesh holoviews datashader folium yt  email:mrajen@rediffmail.com
  • 24. .