PYTHON PROGRAMMING
AND DATA ANALYSIS
WHAT IS PYTHON ?
• Python is a high level programming language
• Used in
• Website Development
• Automation
• Software Testing
• Data Analysis
OTHER USES
• Keep track of crypto prices
• Send yourself a text reminder
• Renaming a large batch of files
• Fill out online forms
• Getting data from online websites
PYTHON IN COMPARISON TO OTHER LANGUAGES
PYTHON SYNTAX
• Python uses indentations
• No braces required for blocks of code
• Comments in Python can be multiline starting with /* and ending with */, or single line with a # at the
start of the code
ANACONDA
• It is a distribution, which you need to install in your computer to run python packages
• Alternatively you can use pip to install your libraries and dependencies
JUPYTER NOTEBOOK
• Jupyter notebook is a server-client application
• It allows notebook document via a web browser
• It can be accessed via following
• Locally on the machine
• Installed on a remote server
PRE – REQUISITES FOR JUPYTER NOTEBOOK
• Python3
• Anaconda
• pip for Python3
INSTALLATION AND OPENING A NOTEBOOK
1. Open a Terminal/Powershell/Command Prompt
2. Type the following “pip install notebook”
3. Then Type “jupyter notebook” to run the notebook
4. Once its running copy the link into a browser which shows on your terminal which should be in the
position of the red underlined in the figure below
CREATING A PYTHON FILE
• Once its opened in the browser, Click on New -> Python 3 (ipykernel) as shown in the image to open a
python notebook
TYPES OF CELL
• There are 4 types of cell in the Jupyter Notebook:
• Code
• Markdown
• RawNBConvert
• Heading
IMPORTING LIBRARIES
• Just like C, you can import python libraries into Jupyter notebook
• Here are a few libraries you require to make your coursework run:
• Pandas
• NumPy
• Matplotlib
READING A FILE
SHORTENING THE DATAFRAME
• Two ways
• Slice by Rows
• df1 = dataframe.iloc[0:9]
• Where 0 is the position where you want to start slicing and 9 is the position where you want to stop.
• Slice by Columns
• df1 = dataframe.iloc[0:9, 0:3]
• Where the first values before the comma is slicing the rows and the values after the comma is slicing the columns
TYPES OF CHARTS
• Line Graphs
• Bar Charts
• Pie Charts
• Histogram
• Scatter plot
• Venn Chart
• Area Charts
• Spline Chart
• Box and Whisker Chart
• Radar Chart
LINE GRAPHS
• Shows data graphically over time.
• Uses
• Show trends
• Make Predictions
• Comparisons
BAR CHARTS
• Bar charts represent categorical data with rectangular bars
(to understand what is categorical data see categorical data
examples).
• Uses:
• Display data that are grouped into nominal or ordinal
categories
• Comparison of different data categories
• Large data over time
• Ideal when there is more than 3 categories of data
PIE CHARTS
• It displays data and statistics in an easy-to-understand
‘pie-slice’ format and illustrates numerical proportion.
• Uses:
• Composition
• Nominal or Ordinal Categories
• Proportional Data
• Areas of Growth
• Data from 3 to 7 categories
HISTOGRAM
• A histogram shows continuous data
• Uses
• Data is continuous
• Shape of the data’s distribution
• Summarize large data sets
• Communicate the data distribution quickly
to others
SCATTER PLOT
• The scatter plot is an X-Y diagram that shows a
relationship between two variables
• Uses
• Relationship between 2 variables
• To predict the behavior of dependent variable
• Having paired numerical data
• When working with root cause analysis tools to identify
the potential for problems.
• Visualize the correlation between 2 large datasets
VENN CHART
• Venn Diagram (also called primary diagram, set
diagram or logic diagrams) uses overlapping circles
to visualize the logical relationships between two
or more group of items.
• Uses:
• Compare and contrast groups of things.
• Categorize or group items.
• Illustrate logical relationships
• Identify all the possible relationships between
collections of datasets.
AREA CHARTS
• Area charts show the change in one or several quantities over
time.
Uses:
• Show Trends
• A simple comparison of the trend of data sets
• Display the magnitude
• Compare a small number of categories.
SPLINE CHART
• The Spline Chart is one of the most widespread types of graphs and charts
used in statistics.
• Uses:
• Product lifecycle chart
• Designing Pareto charts
• Spline chart also is often used for data modeling
BOX AND WHISKER CHART
• A box and whisker chart is a statistical graph for
displaying sets of numerical data through their
quartiles.
• Uses
• When you want to observe the upper, lower quartiles,
mean, median, deviations, etc. for a large set of data.
• Quick view of the dataset distribution.
• Multiple data sets
• Compare data from different categories
RADAR CHART
• A radar chart is one of the most modern types of graphs and
charts – ideal for multiple comparisons.
• Uses:
• When you want to observe which variables have similar values
• To represent multiple comparisons.
• This makes radar chart ideal for displaying performance.
THANK YOU