Experiment No: 1 Introduction To Data Analytics and Python Fundamentals Page-1/11
Experiment No: 1 Introduction To Data Analytics and Python Fundamentals Page-1/11
Data Analytics
Experiment No: 1 Introduction to data analytics and Python fundamentals Page- 1/11
Aim of Experiment:
Introduction to data analytics and Python fundamentals:
Understanding the Data.
Python Packages for Data Science.
Importing and Exporting Data in Python.
Getting Started Analyzing Data in Python.
Accessing Databases with Python
Learning Outcomes:
Theory:
Data Analytics-
Analytics is defined as “the scientific process of transforming data into insights for making
better decisions”
Analytics, is the use of data, information technology, statistical analysis, quantitative
methods, and mathematical or computer-based models to help managers gain improved
insight about their business operations and make better, fact-based decisions – James
Evans
Descriptive Analytics
• Descriptive Analytics, is the conventional form of data analysis
• It seeks to provide a depiction or “summary view” of facts and figures in
• an understandable format
• This either inform or prepare data for further analysis
• Descriptive analysis or statistics can summarize raw data and convert it
into a form that can be easily understood by humans
Experiment No: 1 Introduction to data analytics and Python fundamentals Page- 2/11
• They can describe in detail about an event that has occurred in the past
A common example of Descriptive Analytics are company reports that simply provide a
historic review like:
• Data Queries
• Reports
• Descriptive Statistics
• Data Visualization
• Data dashboard
Diagnostic analytics
• Diagnostic Analytics is a form of advanced analytics which examines data
• or content to answer the question “Why did it happen?”
• Diagnostic analytical tools aid an analyst to dig deeper into an issue so
• that they can arrive at the source of a problem
• In a structured business environment, tools for both descriptive and
• diagnostic analytics go parallel
It uses techniques such as:
• Data Discovery
• Data Mining
• Correlations
Predictive analytics
• Predictive analytics helps to forecast trends based on the current events
• Predicting the probability of an event happening in future or estimating
• the accurate time it will happen can all be determined with the help of
• predictive analytical models
• Many different but co-dependent variables are analysed to predict a trend
• in this type of analysis
Set of techniques that use model constructed from past data to predict the future or
ascertain impact of one variable on another:
1. Linear regression
2. Time series analysis and forecasting
3. Data mining
Prescriptive analytics
• Set of techniques to indicate the best course of action
• It tells what decision to make to optimize the outcome
The goal of prescriptive analytics is to enable:
1. Quality improvements
2. Service enhancements
3. Cost reductions and
4. Increasing productivity
Experiment No: 1 Introduction to data analytics and Python fundamentals Page- 3/11
import numpy as np
# Creating array object
arr = np.array( [[ 1, 2, 3],
[ 4, 2, 5]] )
# Printing type of arr object
print("Array is of type: ", type(arr))
Experiment No: 1 Introduction to data analytics and Python fundamentals Page- 4/11
Output-
Array is of type:
No. of dimensions: 2
Shape of array: (2, 3)
Size of array: 6
Array stores elements of type: int64
Output-
Largest element is: 9
Row-wise maximum elements: [6 7 9]
Column-wise minimum elements: [1 1 2]
Sum of all array elements: 38
a = np.array([[1, 2],
[3, 4]])
b = np.array([[4, 3],
[2, 1]])
# add arrays
print ("Array sum:\n", a + b)
Experiment No: 1 Introduction to data analytics and Python fundamentals Page- 5/11
# matrix multiplication
print ("Matrix multiplication:\n", a.dot(b))
Output
Array sum:
[[5 5]
[5 5]]
Array multiplication:
[[4 6]
[6 4]]
Matrix multiplication:
[[ 8 5]
[20 13]]
Introduction to pandas
Pandas is an open-source library that allows to you perform data manipulation and analysis
in Python.
Pandas Dataframe- A Data frame is a two-dimensional data structure, i.e., data is aligned
in a tabular fashion in rows and columns. A pandas DataFrame can be created using
various inputs like – Lists, dictionary, series, Numpy ndarrays, another DataFrame.
Example
import pandas as pd
data = [['Alex',10],['Bob',12],['Clarke',13]]
df = pd.DataFrame(data,columns=['Name','Age'],dtype=float)
print (df)
Output-
Name Age
0 Alex 10.0
1 Bob 12.0
2 Clarke 13.0
Simple operations on pandas Dataframe
Viewing the first n rows
print(df.head())
Output-
Name Age
0 Alex 10.0
1 Bob 12.0
2 Clarke 13.0
Print a concise summary of a DataFrame
print(df.info())
Output-
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3 entries, 0 to 2
Data columns (total 2 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Name 3 non-null object
1 Age 3 non-null float64
Experiment No: 1 Introduction to data analytics and Python fundamentals Page- 6/11
Output-
Name Hire Date Salary Sick Days remaining
0 Graham Chapman 03/15/14 50000.0 10
1 John Cleese 06/01/15 65000.0 8
2 Eric Idle 05/12/14 45000.0 10
3 Terry Jones 11/01/13 70000.0 3
Experiment No: 1 Introduction to data analytics and Python fundamentals Page- 7/11
print (df)
# Create table
c.execute('''CREATE TABLE stock
(date text, trans text, symbol text, qty real, price real)''')
Output-
('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14)
('2006-03-28', 'BUY', 'IBM', 1000.0, 45.0)
('2006-04-05', 'BUY', 'MSFT', 1000.0, 72.0)
Experiment No: 1 Introduction to data analytics and Python fundamentals Page- 8/11
Assignment:
References:
Conclusion: