SlideShare a Scribd company logo
PROGRAMMING IN PYTHON
MCA-161
4 Credits (3-0-2)
MCA 5th Sem (2020-21)
R K Dwivedi
Assistant Professor
Department of ITCA
MMMUT Gorakhpur
UNIT IV: Advance Concepts
A. Problem solving:
• Use of Python to solve real time problems
• How Python helps to research problems
• Creating various types of graphs corresponding to any data to show different kinds of results and analysis
B. Data Analysis:
• Understanding problems of data science and machine learning
• Creating codes for data analysis problems in Python
• Other advance programs
11-11-2020 Side 3
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
A. Problem solving
11-11-2020 Side 4
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Use of Python to solve real time problems
11-11-2020 Side 5
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Use of Python to solve real time problems
• Python can be used on a server to create web applications.
• It can be used to create GUI based desktop applications(Games, Scientific and Business Applications).
• It is also used to create test frameworks and multimedia applications.
• It is used to develop operating systems and programming language.
• It can be used to handle image processing, text processing and natural language processing.
• It can be used to create programs for machine learning, deep learning, data science, big data and data analytics applications.
• It can also perform complex mathematics along with all cutting edge technology in software industry.
Organizations and tech-giant companies using Python :
1) Google(Components of Google spider and Search Engine)
2) Yahoo(Maps)
3) YouTube
4) Mozilla
5) Dropbox
6) Microsoft
7) Cisco
8) Spotify
9) Quora
10) Instagram
11)Amazon
12)Facebook
13)Uber etc.
11-11-2020 Side 6
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Use of Python to solve real time problems …continued
Some Real Time Projects, their Python Codes and Datasets :
https://data-flair.training/blogs/python-project-ideas/
https://data-flair.training/blogs/django-project-ideas/
https://data-flair.training/blogs/data-science-project-ideas/
https://data-flair.training/blogs/artificial-intelligence-project-ideas/
https://data-flair.training/blogs/machine-learning-project-ideas/
https://data-flair.training/blogs/deep-learning-project-ideas/
https://data-flair.training/blogs/iot-project-ideas/
https://data-flair.training/blogs/computer-vision-project-ideas/
https://archive.ics.uci.edu/ml/datasets.php
https://www.kaggle.com/datasets
https://github.com/topics/covid-19
11-11-2020 Side 7
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
2. How Python helps to research problems
11-11-2020 Side 8
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
2. How Python helps to research problems
It can be used in various types of research areas such as:
• Image Processing
• Text Processing
• Natural Language Processing
• Machine Learning
• Deep Learning
• Data Science
• Big Data Analytics
11-11-2020 Side 9
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
3. Creating various types of graphs corresponding to any data
(to show different kinds of results and analysis)
11-11-2020 Side 10
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
• Matplotlib is a graph plotting library in python that serves as a visualization utility.
• NumPy (Numerical Python) is a python library used for working with arrays.
• NumPy also has functions for working in the domain of linear algebra, fourier transform, and matrices.
• subplot( ) allows to draw multiple plots in one fig. (subplot(no of rows, no of columns, index of current plot)
• All modern browsers support 140 color names (Syntax: color=‘r’ or color=‘red’ or c=‘r’ or c=‘red’).
• A hexadecimal color is specified with: #RRGGBB (Syntax: color=‘#0000ff’ or c=‘0000ff’).
A. Line Graph:
• linestyle can be written as ls in a shorter syntax.
• linewidth can be written as lw in a shorter syntax.
• color can be written as c in a shorter syntax.
linestyle short syntax
solid' (default) '-'
'dotted' ':'
'dashed' '--'
'dashdot' '-.'
'None' '' or ' '
'r' - Red
'g' - Green
'b' - Blue
'c' - Cyan
'm' - Magenta
'y' - Yellow
'k' - Black
'w' - White
11-11-2020 Side 11
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
…continued
11-11-2020 Side 12
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
…continued
B. Bar Graph:
• The default width value of the bars is 0.8.
• bar ( ) function displays the bar graph vertically and barh( ) function displays the bar graph horizontally.
11-11-2020 Side 13
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
…continued
11-11-2020 Side 14
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
…continued
C. Pie Chart:
• By default the plotting of the first wedge starts from the x-axis and move counterclockwise.
• pie( ) function is used to draw the pie charts.
• pie(populationShare, labelsWedge, colors, startAngle, explode, shadow)
• legend(title = "Four Fruits:", loc='lower right')
Location String Location Code
'best' 0
'upper right' 1
'upper left' 2
'lower left' 3
'lower right' 4
'right' 5
'center left' 6
'center right' 7
'lower center' 8
'upper center' 9
'center' 10
11-11-2020 Side 15
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
…continued
11-11-2020 Side 16
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
…continued
11-11-2020 Side 17
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
…continued
D. Histogram:
• A histogram is a graph showing frequency distributions.
• It is a graph showing the number of observations within each given interval.
• hist() function to create histograms.
• Create a histogram to represent following:
❖ 2 people from 140 to 145cm
❖ 5 people from 145 to 150cm
❖ 15 people from 151 to 156cm
❖ 31 people from 157 to 162cm
❖ 46 people from 163 to 168cm
❖ 53 people from 168 to 173cm
❖ 45 people from 173 to 178cm
❖ 28 people from 179 to 184cm
❖ 21 people from 185 to 190cm
❖ 4 people from 190 to 195cm
• For this, function numpy.random.normal(170, 10, 250) can be used which shows that NumPy uses Normal
Distribution to randomly generate an array with 250 values, where the values will concentrate around 170,
and the standard deviation is 10.
11-11-2020 Side 18
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
…continued
11-11-2020 Side 19
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
B. Data Analysis
11-11-2020 Side 20
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning
11-11-2020 Side 21
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning
A. Introduction:
11-11-2020 Side 22
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
B. Procedure:
11-11-2020 Side 23
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
C. Applications:
11-11-2020 Side 24
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
A. Introduction:
11-11-2020 Side 25
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
B. Relation among AI, ML, NN, and DL:
11-11-2020 Side 26
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
C. Types of ML:
•Supervised Learning – Train Me!
•Unsupervised Learning – I am self sufficient in learning
•Reinforcement Learning – My life My rules! (Hit & Trial)
11-11-2020 Side 27
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
D. Techniques used in ML:
11-11-2020 Side 28
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
E. Procedure (View 1)
Usually 80% data for training, and 20% data for testing
11-11-2020 Side 29
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
E. Procedure (View 2)
11-11-2020 Side 30
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
E. Procedure (View 3)
11-11-2020 Side 31
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
F. Applications (View 1):
11-11-2020 Side 32
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
F. Applications (View 2):
11-11-2020 Side 33
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
1. Understanding problems of data science and machine learning …continued
F. Applications (View 3):
11-11-2020 Side 34
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
2. Creating codes for data analysis problems in Python
11-11-2020 Side 35
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
2. Creating codes for data analysis problems in Python
First of all, import or load the dataset and then analyse it.
A. The basic process of loading data from a CSV file with Pandas
# Load the Pandas libraries with alias 'pd'
import pandas as pd
# Read data from file 'filename.csv' (in the same directory)
data = pd.read_csv("filename.csv")
# Preview the first 5 lines of the loaded data
data.head()
import pandas
filename = ‘indians-diabetes.data.csv'
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
data = pandas.read_csv(filename, names=names)
print(data.shape)
OR
11-11-2020 Side 36
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
2. Creating codes for data analysis problems in Python …continued
C. The basic process of loading data from a CSV file with Python Standard Library
B. The basic process of loading data from a CSV file with NumPy
import numpy
filename = 'indians-diabetes.data.csv'
raw_data = open(filename, 'rt')
data = numpy.loadtxt(raw_data, delimiter=",")
print(data.shape)
import csv
import numpy
filename = 'indians-diabetes.data.csv'
raw_data = open(filename, 'rt')
reader = csv.reader(raw_data, delimiter=‘,’ , quoting=csv.QUOTE_NONE)
x = list(reader)
data = numpy.array(x).astype('float')
print(data.shape)
11-11-2020 Side 37
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
2. Creating codes for data analysis problems in Python …continued
D. Data Analysis
11-11-2020 Side 38
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
3. Other advance programs
11-11-2020 Side 39
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
3. Other advance programs: Calendar (I)
11-11-2020 Side 40
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
3. Other advance programs : Calendar (II) …continued
11-11-2020 Side 41
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
3. Other advance programs: Calculator …continued
https://data-flair.s3.ap-south-1.amazonaws.com/python-projects/dataflair-python-calculator.zip
11-11-2020 Side 42
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
3. Other advance programs: Currency Converter …continued
https://data-flair.s3.ap-south-1.amazonaws.com/python-projects/currency-converter-project.zip
11-11-2020 Side 43
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
3. Other advance programs: Music Player …continued
https://project-gurukul.s3.ap-south-1.amazonaws.com/python-projects/music-player-python.zip
11-11-2020 Side 44
Madan Mohan Malaviya Univ. of Technology, Gorakhpur
3. Other advance programs: Alarm Clock …continued
https://data-flair.s3.ap-south-1.amazonaws.com/python-projects/DataFlair-Alarm-Clock.zip
Queries ?
Ad

Recommended

Class 12 Ip Whole Text Book Preeti Arora
Class 12 Ip Whole Text Book Preeti Arora
VaibhavGour7
 
Data Science & AI Road Map by Python & Computer science tutor in Malaysia
Data Science & AI Road Map by Python & Computer science tutor in Malaysia
Ahmed Elmalla
 
PDS Unit - 1 Introdiction to DS.ppt
PDS Unit - 1 Introdiction to DS.ppt
ssuser52a19e
 
VANITHA S.docx.pptxdata science with python
VANITHA S.docx.pptxdata science with python
ksaravanakumar450
 
Presentation.pptx
Presentation.pptx
KumarKumar570063
 
R.SOWMIYA (30323U09086).pptx data science with python
R.SOWMIYA (30323U09086).pptx data science with python
ksaravanakumar450
 
-python-for-data-science-20240911071905Ss8z.pdf
-python-for-data-science-20240911071905Ss8z.pdf
abhishekprasadabhima
 
pdsa new ppt for subject marking and pyt
pdsa new ppt for subject marking and pyt
ssuser72b8e8
 
Adarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptx
hkabir55
 
Data Science - Learning path by thedatascienceportal
Data Science - Learning path by thedatascienceportal
Pranjal Pandey
 
Schedule Classes DataLab Community
Schedule Classes DataLab Community
Andres Mendez-Vazquez
 
Course outline
Course outline
SumbalImran2
 
Certified Professional Diploma in Data Science.pdf
Certified Professional Diploma in Data Science.pdf
romanpaul8888
 
An Overview of Python for Data Analytics
An Overview of Python for Data Analytics
IRJET Journal
 
Data analysis using python in Jupyter notebook.pptx
Data analysis using python in Jupyter notebook.pptx
ssuserc26f8f
 
Data science
Data science
allytech
 
Radhika (30323U09065).pptx data science with python
Radhika (30323U09065).pptx data science with python
ksaravanakumar450
 
Data science fullOCS353 UNIT 1 UPDATED.pptx
Data science fullOCS353 UNIT 1 UPDATED.pptx
manikandancsesdm
 
Python
Python
BALUJAINSTITUTE
 
Abhishek Training PPT.pptx
Abhishek Training PPT.pptx
KashishKashish22
 
S2-Programming_with_Data_Computational_Physics.pdf
S2-Programming_with_Data_Computational_Physics.pdf
CARLOSANDRESVIDALBET
 
Python.pptx
Python.pptx
SajjadAbdullah4
 
Python for Data Science: A Comprehensive Guide
Python for Data Science: A Comprehensive Guide
priyanka rajput
 
Complete Introduction To DataScience PPT
Complete Introduction To DataScience PPT
ARUN R S
 
2015 03-28-eb-final
2015 03-28-eb-final
Christopher Wilson
 
Introduction To Data Science Laura Igual Santi Segu
Introduction To Data Science Laura Igual Santi Segu
kotilnurita
 
Data Science Roadmap by Swapnil Microsoft
Data Science Roadmap by Swapnil Microsoft
geekism12
 
PYTHON FOR DATA SCIENCE- EXPLAINED IN 6 EASY STEPS
PYTHON FOR DATA SCIENCE- EXPLAINED IN 6 EASY STEPS
USDSI
 
Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 

More Related Content

Similar to Python Programming Unit 4 Problem Solving and Data Analysis (20)

Adarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptx
hkabir55
 
Data Science - Learning path by thedatascienceportal
Data Science - Learning path by thedatascienceportal
Pranjal Pandey
 
Schedule Classes DataLab Community
Schedule Classes DataLab Community
Andres Mendez-Vazquez
 
Course outline
Course outline
SumbalImran2
 
Certified Professional Diploma in Data Science.pdf
Certified Professional Diploma in Data Science.pdf
romanpaul8888
 
An Overview of Python for Data Analytics
An Overview of Python for Data Analytics
IRJET Journal
 
Data analysis using python in Jupyter notebook.pptx
Data analysis using python in Jupyter notebook.pptx
ssuserc26f8f
 
Data science
Data science
allytech
 
Radhika (30323U09065).pptx data science with python
Radhika (30323U09065).pptx data science with python
ksaravanakumar450
 
Data science fullOCS353 UNIT 1 UPDATED.pptx
Data science fullOCS353 UNIT 1 UPDATED.pptx
manikandancsesdm
 
Python
Python
BALUJAINSTITUTE
 
Abhishek Training PPT.pptx
Abhishek Training PPT.pptx
KashishKashish22
 
S2-Programming_with_Data_Computational_Physics.pdf
S2-Programming_with_Data_Computational_Physics.pdf
CARLOSANDRESVIDALBET
 
Python.pptx
Python.pptx
SajjadAbdullah4
 
Python for Data Science: A Comprehensive Guide
Python for Data Science: A Comprehensive Guide
priyanka rajput
 
Complete Introduction To DataScience PPT
Complete Introduction To DataScience PPT
ARUN R S
 
2015 03-28-eb-final
2015 03-28-eb-final
Christopher Wilson
 
Introduction To Data Science Laura Igual Santi Segu
Introduction To Data Science Laura Igual Santi Segu
kotilnurita
 
Data Science Roadmap by Swapnil Microsoft
Data Science Roadmap by Swapnil Microsoft
geekism12
 
PYTHON FOR DATA SCIENCE- EXPLAINED IN 6 EASY STEPS
PYTHON FOR DATA SCIENCE- EXPLAINED IN 6 EASY STEPS
USDSI
 
Adarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptx
hkabir55
 
Data Science - Learning path by thedatascienceportal
Data Science - Learning path by thedatascienceportal
Pranjal Pandey
 
Certified Professional Diploma in Data Science.pdf
Certified Professional Diploma in Data Science.pdf
romanpaul8888
 
An Overview of Python for Data Analytics
An Overview of Python for Data Analytics
IRJET Journal
 
Data analysis using python in Jupyter notebook.pptx
Data analysis using python in Jupyter notebook.pptx
ssuserc26f8f
 
Data science
Data science
allytech
 
Radhika (30323U09065).pptx data science with python
Radhika (30323U09065).pptx data science with python
ksaravanakumar450
 
Data science fullOCS353 UNIT 1 UPDATED.pptx
Data science fullOCS353 UNIT 1 UPDATED.pptx
manikandancsesdm
 
Abhishek Training PPT.pptx
Abhishek Training PPT.pptx
KashishKashish22
 
S2-Programming_with_Data_Computational_Physics.pdf
S2-Programming_with_Data_Computational_Physics.pdf
CARLOSANDRESVIDALBET
 
Python for Data Science: A Comprehensive Guide
Python for Data Science: A Comprehensive Guide
priyanka rajput
 
Complete Introduction To DataScience PPT
Complete Introduction To DataScience PPT
ARUN R S
 
Introduction To Data Science Laura Igual Santi Segu
Introduction To Data Science Laura Igual Santi Segu
kotilnurita
 
Data Science Roadmap by Swapnil Microsoft
Data Science Roadmap by Swapnil Microsoft
geekism12
 
PYTHON FOR DATA SCIENCE- EXPLAINED IN 6 EASY STEPS
PYTHON FOR DATA SCIENCE- EXPLAINED IN 6 EASY STEPS
USDSI
 

Recently uploaded (20)

Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
ijab2
 
Modern multi-proposer consensus implementations
Modern multi-proposer consensus implementations
François Garillot
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
nnnnnnnnnnnn7777777777777777777777777777777.pptx
nnnnnnnnnnnn7777777777777777777777777777777.pptx
gayathri venkataramani
 
NEW Strengthened Senior High School Gen Math.pptx
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
Industrial internet of things IOT Week-3.pptx
Industrial internet of things IOT Week-3.pptx
KNaveenKumarECE
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
Solar thermal – Flat plate and concentrating collectors .pptx
Solar thermal – Flat plate and concentrating collectors .pptx
jdaniabraham1
 
ElysiumPro Company Profile 2025-2026.pdf
ElysiumPro Company Profile 2025-2026.pdf
info751436
 
Cadastral Maps
Cadastral Maps
Google
 
Introduction to Python Programming Language
Introduction to Python Programming Language
merlinjohnsy
 
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
23Q95A6706
 
60 Years and Beyond eBook 1234567891.pdf
60 Years and Beyond eBook 1234567891.pdf
waseemalazzeh
 
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
resming1
 
How to Un-Obsolete Your Legacy Keypad Design
How to Un-Obsolete Your Legacy Keypad Design
Epec Engineered Technologies
 
Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
ijab2
 
Modern multi-proposer consensus implementations
Modern multi-proposer consensus implementations
François Garillot
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
nnnnnnnnnnnn7777777777777777777777777777777.pptx
nnnnnnnnnnnn7777777777777777777777777777777.pptx
gayathri venkataramani
 
NEW Strengthened Senior High School Gen Math.pptx
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
Industrial internet of things IOT Week-3.pptx
Industrial internet of things IOT Week-3.pptx
KNaveenKumarECE
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
Solar thermal – Flat plate and concentrating collectors .pptx
Solar thermal – Flat plate and concentrating collectors .pptx
jdaniabraham1
 
ElysiumPro Company Profile 2025-2026.pdf
ElysiumPro Company Profile 2025-2026.pdf
info751436
 
Cadastral Maps
Cadastral Maps
Google
 
Introduction to Python Programming Language
Introduction to Python Programming Language
merlinjohnsy
 
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
23Q95A6706
 
60 Years and Beyond eBook 1234567891.pdf
60 Years and Beyond eBook 1234567891.pdf
waseemalazzeh
 
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
resming1
 
Ad

Python Programming Unit 4 Problem Solving and Data Analysis

  • 1. PROGRAMMING IN PYTHON MCA-161 4 Credits (3-0-2) MCA 5th Sem (2020-21) R K Dwivedi Assistant Professor Department of ITCA MMMUT Gorakhpur
  • 2. UNIT IV: Advance Concepts A. Problem solving: • Use of Python to solve real time problems • How Python helps to research problems • Creating various types of graphs corresponding to any data to show different kinds of results and analysis B. Data Analysis: • Understanding problems of data science and machine learning • Creating codes for data analysis problems in Python • Other advance programs
  • 3. 11-11-2020 Side 3 Madan Mohan Malaviya Univ. of Technology, Gorakhpur A. Problem solving
  • 4. 11-11-2020 Side 4 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Use of Python to solve real time problems
  • 5. 11-11-2020 Side 5 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Use of Python to solve real time problems • Python can be used on a server to create web applications. • It can be used to create GUI based desktop applications(Games, Scientific and Business Applications). • It is also used to create test frameworks and multimedia applications. • It is used to develop operating systems and programming language. • It can be used to handle image processing, text processing and natural language processing. • It can be used to create programs for machine learning, deep learning, data science, big data and data analytics applications. • It can also perform complex mathematics along with all cutting edge technology in software industry. Organizations and tech-giant companies using Python : 1) Google(Components of Google spider and Search Engine) 2) Yahoo(Maps) 3) YouTube 4) Mozilla 5) Dropbox 6) Microsoft 7) Cisco 8) Spotify 9) Quora 10) Instagram 11)Amazon 12)Facebook 13)Uber etc.
  • 6. 11-11-2020 Side 6 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Use of Python to solve real time problems …continued Some Real Time Projects, their Python Codes and Datasets : https://data-flair.training/blogs/python-project-ideas/ https://data-flair.training/blogs/django-project-ideas/ https://data-flair.training/blogs/data-science-project-ideas/ https://data-flair.training/blogs/artificial-intelligence-project-ideas/ https://data-flair.training/blogs/machine-learning-project-ideas/ https://data-flair.training/blogs/deep-learning-project-ideas/ https://data-flair.training/blogs/iot-project-ideas/ https://data-flair.training/blogs/computer-vision-project-ideas/ https://archive.ics.uci.edu/ml/datasets.php https://www.kaggle.com/datasets https://github.com/topics/covid-19
  • 7. 11-11-2020 Side 7 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 2. How Python helps to research problems
  • 8. 11-11-2020 Side 8 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 2. How Python helps to research problems It can be used in various types of research areas such as: • Image Processing • Text Processing • Natural Language Processing • Machine Learning • Deep Learning • Data Science • Big Data Analytics
  • 9. 11-11-2020 Side 9 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 3. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis)
  • 10. 11-11-2020 Side 10 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) • Matplotlib is a graph plotting library in python that serves as a visualization utility. • NumPy (Numerical Python) is a python library used for working with arrays. • NumPy also has functions for working in the domain of linear algebra, fourier transform, and matrices. • subplot( ) allows to draw multiple plots in one fig. (subplot(no of rows, no of columns, index of current plot) • All modern browsers support 140 color names (Syntax: color=‘r’ or color=‘red’ or c=‘r’ or c=‘red’). • A hexadecimal color is specified with: #RRGGBB (Syntax: color=‘#0000ff’ or c=‘0000ff’). A. Line Graph: • linestyle can be written as ls in a shorter syntax. • linewidth can be written as lw in a shorter syntax. • color can be written as c in a shorter syntax. linestyle short syntax solid' (default) '-' 'dotted' ':' 'dashed' '--' 'dashdot' '-.' 'None' '' or ' ' 'r' - Red 'g' - Green 'b' - Blue 'c' - Cyan 'm' - Magenta 'y' - Yellow 'k' - Black 'w' - White
  • 11. 11-11-2020 Side 11 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) …continued
  • 12. 11-11-2020 Side 12 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) …continued B. Bar Graph: • The default width value of the bars is 0.8. • bar ( ) function displays the bar graph vertically and barh( ) function displays the bar graph horizontally.
  • 13. 11-11-2020 Side 13 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) …continued
  • 14. 11-11-2020 Side 14 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) …continued C. Pie Chart: • By default the plotting of the first wedge starts from the x-axis and move counterclockwise. • pie( ) function is used to draw the pie charts. • pie(populationShare, labelsWedge, colors, startAngle, explode, shadow) • legend(title = "Four Fruits:", loc='lower right') Location String Location Code 'best' 0 'upper right' 1 'upper left' 2 'lower left' 3 'lower right' 4 'right' 5 'center left' 6 'center right' 7 'lower center' 8 'upper center' 9 'center' 10
  • 15. 11-11-2020 Side 15 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) …continued
  • 16. 11-11-2020 Side 16 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) …continued
  • 17. 11-11-2020 Side 17 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) …continued D. Histogram: • A histogram is a graph showing frequency distributions. • It is a graph showing the number of observations within each given interval. • hist() function to create histograms. • Create a histogram to represent following: ❖ 2 people from 140 to 145cm ❖ 5 people from 145 to 150cm ❖ 15 people from 151 to 156cm ❖ 31 people from 157 to 162cm ❖ 46 people from 163 to 168cm ❖ 53 people from 168 to 173cm ❖ 45 people from 173 to 178cm ❖ 28 people from 179 to 184cm ❖ 21 people from 185 to 190cm ❖ 4 people from 190 to 195cm • For this, function numpy.random.normal(170, 10, 250) can be used which shows that NumPy uses Normal Distribution to randomly generate an array with 250 values, where the values will concentrate around 170, and the standard deviation is 10.
  • 18. 11-11-2020 Side 18 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Creating various types of graphs corresponding to any data (to show different kinds of results and analysis) …continued
  • 19. 11-11-2020 Side 19 Madan Mohan Malaviya Univ. of Technology, Gorakhpur B. Data Analysis
  • 20. 11-11-2020 Side 20 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning
  • 21. 11-11-2020 Side 21 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning A. Introduction:
  • 22. 11-11-2020 Side 22 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued B. Procedure:
  • 23. 11-11-2020 Side 23 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued C. Applications:
  • 24. 11-11-2020 Side 24 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued A. Introduction:
  • 25. 11-11-2020 Side 25 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued B. Relation among AI, ML, NN, and DL:
  • 26. 11-11-2020 Side 26 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued C. Types of ML: •Supervised Learning – Train Me! •Unsupervised Learning – I am self sufficient in learning •Reinforcement Learning – My life My rules! (Hit & Trial)
  • 27. 11-11-2020 Side 27 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued D. Techniques used in ML:
  • 28. 11-11-2020 Side 28 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued E. Procedure (View 1) Usually 80% data for training, and 20% data for testing
  • 29. 11-11-2020 Side 29 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued E. Procedure (View 2)
  • 30. 11-11-2020 Side 30 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued E. Procedure (View 3)
  • 31. 11-11-2020 Side 31 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued F. Applications (View 1):
  • 32. 11-11-2020 Side 32 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued F. Applications (View 2):
  • 33. 11-11-2020 Side 33 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 1. Understanding problems of data science and machine learning …continued F. Applications (View 3):
  • 34. 11-11-2020 Side 34 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 2. Creating codes for data analysis problems in Python
  • 35. 11-11-2020 Side 35 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 2. Creating codes for data analysis problems in Python First of all, import or load the dataset and then analyse it. A. The basic process of loading data from a CSV file with Pandas # Load the Pandas libraries with alias 'pd' import pandas as pd # Read data from file 'filename.csv' (in the same directory) data = pd.read_csv("filename.csv") # Preview the first 5 lines of the loaded data data.head() import pandas filename = ‘indians-diabetes.data.csv' names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class'] data = pandas.read_csv(filename, names=names) print(data.shape) OR
  • 36. 11-11-2020 Side 36 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 2. Creating codes for data analysis problems in Python …continued C. The basic process of loading data from a CSV file with Python Standard Library B. The basic process of loading data from a CSV file with NumPy import numpy filename = 'indians-diabetes.data.csv' raw_data = open(filename, 'rt') data = numpy.loadtxt(raw_data, delimiter=",") print(data.shape) import csv import numpy filename = 'indians-diabetes.data.csv' raw_data = open(filename, 'rt') reader = csv.reader(raw_data, delimiter=‘,’ , quoting=csv.QUOTE_NONE) x = list(reader) data = numpy.array(x).astype('float') print(data.shape)
  • 37. 11-11-2020 Side 37 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 2. Creating codes for data analysis problems in Python …continued D. Data Analysis
  • 38. 11-11-2020 Side 38 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 3. Other advance programs
  • 39. 11-11-2020 Side 39 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 3. Other advance programs: Calendar (I)
  • 40. 11-11-2020 Side 40 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 3. Other advance programs : Calendar (II) …continued
  • 41. 11-11-2020 Side 41 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 3. Other advance programs: Calculator …continued https://data-flair.s3.ap-south-1.amazonaws.com/python-projects/dataflair-python-calculator.zip
  • 42. 11-11-2020 Side 42 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 3. Other advance programs: Currency Converter …continued https://data-flair.s3.ap-south-1.amazonaws.com/python-projects/currency-converter-project.zip
  • 43. 11-11-2020 Side 43 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 3. Other advance programs: Music Player …continued https://project-gurukul.s3.ap-south-1.amazonaws.com/python-projects/music-player-python.zip
  • 44. 11-11-2020 Side 44 Madan Mohan Malaviya Univ. of Technology, Gorakhpur 3. Other advance programs: Alarm Clock …continued https://data-flair.s3.ap-south-1.amazonaws.com/python-projects/DataFlair-Alarm-Clock.zip