Data Analytics and AI

1️⃣ What is Data Analytics?

👉 Data Analytics = Turning raw data into useful insights for decision-making.

  • Data = raw facts (e.g., daily cab fares, student marks).

  • Analytics = finding patterns & answers from data.

  • Purpose = make better business decisions.

Example:
Chai stall daily cups sold →

  • Find busiest day?

  • Do weekends sell more?

  • Should I buy extra milk on Fridays?


2️⃣ Types of Data Analytics

  1. Descriptive → What happened? (e.g., Total sales this month)

  2. Diagnostic → Why did it happen? (e.g., Sales dropped on holidays)

  3. Predictive → What might happen? (e.g., Diwali sales forecast)

  4. Prescriptive → What should we do? (e.g., Add more staff on weekends)


3️⃣ Role of a Data Analyst

A Data Analyst is a translator between data & business.

Main tasks:

  1. Collect data (Excel, SQL, Surveys).

  2. Clean data (remove errors, duplicates, missing).

  3. Analyze data (formulas, queries, stats).

  4. Visualize (charts, dashboards).

  5. Share insights in plain language.

Example (Swiggy):

  • Data: Orders from cities.

  • Insight: “Hyderabad = top biryani city.”

  • Action: Add more delivery partners in Hyderabad weekends.


4️⃣ Data Cleaning Basics

👉 Rule: Clean first, analyze later (“Garbage In → Garbage Out”).

Steps:

  1. Spelling errors (Prodct A → Product A).

  2. Missing values (replace with 0 or average).

  3. Outliers (Sales = -50, Sales = 100000 → check business meaning).

  4. Consistency (dates, formats, spaces).

✅ Don’t delete strange values blindly → understand the business (e.g., negative = refunds).


5️⃣ Descriptive Analytics (Basics)

Answers “What happened?”

Techniques:

  • Total (SUM)

  • Average (AVG)

  • Max/Min

  • Count

  • Percentages / Growth

Example:

Date Product Sales
01-08 A 100
02-08 A 0
03-08 B 200
04-08 A 1000
05-08 C 150
  • Total sales = 1450

  • Avg sales/day = 290

  • Highest sale = 1000

  • Lowest sale = 0


6️⃣ SQL Basics (Setup)

Why SQL? Works on millions of rows, much faster than Excel.

Setup (beginner):

  1. Install DB Browser for SQLite.

  2. Create database learn_sql.sqlite.

  3. Create table:

CREATE TABLE sales (
  id INTEGER PRIMARY KEY,
  sales_date TEXT,
  product TEXT,
  amount INTEGER
);

Insert sample data:

INSERT INTO sales (sales_date, product, amount) VALUES
('2025-08-01','Product A',100),
('2025-08-02','Product A',0),
('2025-08-03','Product B',200),
('2025-08-04','Product A',1000),
('2025-08-05','Product C',150);

7️⃣ SQL vs Excel (Formula Mapping)

Task Excel SQL
Show all data (view sheet) SELECT * FROM sales;
Sum =SUM(C2:C100) SELECT SUM(amount) FROM sales;
Average =AVERAGE(C2:C100) SELECT AVG(amount) FROM sales;
Max/Min =MAX(C:C), =MIN(C:C) SELECT MAX(amount), MIN(amount) FROM sales;
Count rows =COUNTA(C:C) SELECT COUNT(*) FROM sales;
Count > 500 =COUNTIF(C:C,">500")

SELECT COUNT(*) FROM sales WHERE amount > 500;