Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
suyashi29
GitHub Repository: suyashi29/python-su
Path: blob/master/Data Analytics Using Python/1 Introduction to Data Analytics and Python basics.ipynb
3074 views
Kernel: Python 3 (ipykernel)

Introduction to Data Analytics & Python Basics

  • What is Data Analytics?

  • Types of Data Analytics

  • Basic Python programming concepts

What is Data Analytics?

Data Analytics is the science of analyzing raw data to make conclusions about information. It involves:

  • Inspecting

  • Cleaning

  • Transforming

  • Modeling data

The goal is to discover useful information, draw conclusions, and support decision-making.

Types of Data Analytics

  1. Descriptive Analytics: What has happened?

  2. Diagnostic Analytics: Why did it happen?

  3. Predictive Analytics: What is likely to happen?

  4. Prescriptive Analytics: What should be done?

Here are clear, practical examples for each of the four types of data analytics:


1. Descriptive Analytics – “What has happened?”

Goal: Summarize historical data to understand trends and patterns.

Example:

A retail company analyzes last year’s sales data to find out:

  • Total sales per month

  • Top 10 selling products

  • Customer demographics

Tools used: Excel, SQL, Tableau, basic Python (e.g., pandas.describe())


2. Diagnostic Analytics – “Why did it happen?”

Goal: Find reasons behind past outcomes.

Example:

The same retail company investigates why sales dropped in November:

  • Product reviews reveal customer dissatisfaction

  • Stockout reports show inventory shortages

  • Campaign data shows reduced marketing spend

Tools used: SQL joins, correlation analysis, root cause analysis, Python stats (scipy, statsmodels)


3. Predictive Analytics – “What is likely to happen?”

Goal: Use historical data to forecast future outcomes.

Example:

Predict next quarter’s sales using:

  • Past sales trends

  • Seasonality patterns

  • Economic indicators

Tools used: Machine Learning (e.g., Linear Regression, ARIMA), Python (scikit-learn), R


4. Prescriptive Analytics – “What should be done?”

Goal: Recommend actions based on predictions and scenarios.

Example:

To increase profits, the company runs simulations to:

  • Optimize pricing strategies

  • Decide how much inventory to restock

  • Allocate marketing budget across regions

Tools used: Optimization models, Decision Trees, Scenario modeling, Python (PuLP, cvxpy), analytics platforms

Getting Started with Python

Python is widely used in data analytics due to its simplicity and the powerful libraries available.

# Print a simple message print("Hello, Data Analytics World!") print(1,2,3,sep="\n")
Hello, Data Analytics World! 1 2 3

Variables and Data Types

Let's explore Python variables and basic data types.

# Define variables name = "Alice" age = 30 height = 5.6 is_student = True # Print them print(f"Name: {name}, Age: {age}, Height: {height}, Student: {is_student}")
Name: Alice, Age: 30, Height: 5.6, Student: True
type(name),type(age),type(height),type(is_student ),type(2+8j)
(str, int, float, bool, complex)
a=int(input())
2
b=int(input())
3
a*b
6
## Input Variable x=input("Enter Name: ") y=int(input("Enter Age:")) z=float(input("Enter Height:"))
Enter Name: A Enter Age:24 Enter Height:122.3
#type casting int("23") int(10.9) str(12.2) float(12)
12.0

Quick Practice

  • Create a welcome inteface

  • Ask user to enter their age

  • if age is greater than 18 then ask them to create a user name and password ask to enter.

  • if user name is correct then request for password

  • if password is correct mention"Welcome and create your profile

age=int(input())
12
if age>=18: print("Welcome and create user Name") user=input("userName") else: print("User not allowed to Sign in ")
User not allowed to Sign in