🔵 Data Science  ·  Lesson 42

Statistics for Data Science

Data Science के लिए Statistics

What are Statistics Basics?

Statistics Basics means statistics helps summarize and understand data using mean, median, mode, range and standard deviation.

In real programs, this topic helps in summarising marks. Learn the idea first, then type the program yourself and compare the output.

💡 At a Glance
PointDetails
Course AreaData Science
Tools and concepts used to analyse, clean and present data.
Main Usesummarising marks
Example Filestatistics-basics.py
Practice FocusRun, change values, and explain the output line by line.

Why should you learn this?

  • It is useful for summarising marks.
  • It connects with understanding average and spread.
  • It improves your ability to read, write and debug Python programs.

Important Terms

These terms are used directly in this lesson. Understand them before memorising the code.

TermMeaning
meanAverage value.
medianMiddle value after sorting.
modeMost frequent value.
varianceSpread of data values.
standard deviationMeasure of spread around the mean.

Syntax / Basic Pattern

The simple pattern is: prepare data, apply the concept, then show the result.

Basic Pattern
import statistics as stats
marks = [80, 85, 85, 90, 100]
print("Mean:", stats.mean(marks))
print("Median:", stats.median(marks))
print("Mode:", stats.mode(marks))

Complete Example Program

Python – statistics-basics.py
import statistics as stats

marks = [80, 85, 85, 90, 100]
print("Mean:", stats.mean(marks))
print("Median:", stats.median(marks))
print("Mode:", stats.mode(marks))

Expected Output

Mean: 88 Median: 85 Mode: 85

Program Explanation

  • import statistics as stats imports ready-made features from a module/library.
  • marks = [80, 85, 85, 90, 100] stores a value in marks.
  • print("Mean:", stats.mean(marks)) displays information or calculated result on the screen.
  • print("Median:", stats.median(marks)) displays information or calculated result on the screen.
  • print("Mode:", stats.mode(marks)) displays information or calculated result on the screen.

Where will you use it?

  • Summarising marks.
  • Understanding average and spread.
  • Supporting ml decisions.

Common Mistakes

  • Analysing data before checking missing values, duplicates and data types.
  • Changing original data without keeping a clean copy.
  • Creating charts without title, labels or explanation.

Practice Tasks

  1. Type the program in statistics-basics.py and run it.
  2. Change input values or sample data and observe the new output.
  3. Create one example related to summarising marks.
  4. Write 5 lines explaining the logic in your own words.

Summary

Statistics Basics is not a theory-only topic. You should be able to explain the meaning, write the example, run it successfully, and use it in a small practical program.

Statistics Basics क्या है?

Statistics Basics ka matlab hai: Statistics helps summarize and understand data using mean, median, mode, range and standard deviation. Simple words me, ye topic practical Python programs likhne me direct use hota hai.

Is topic ko sirf definition ke liye nahi, balki summarising marks jaise real examples ke liye practice karein.

यह क्यों सीखना जरूरी है?

  • Ye summarising marks me kaam aata hai.
  • Ye understanding average and spread se bhi connected hai.
  • Isse aap code ka output aur errors better samajh paate hain.

Important Terms

TermMeaning
meanAverage value.
medianMiddle value after sorting.
modeMost frequent value.
varianceSpread of data values.
standard deviationMeasure of spread around the mean.

Syntax / Basic Pattern

Basic idea: pehle data तैयार करें, phir Python logic apply करें, aur finally result display करें.

Basic Pattern
import statistics as stats
marks = [80, 85, 85, 90, 100]
print("Mean:", stats.mean(marks))
print("Median:", stats.median(marks))
print("Mode:", stats.mode(marks))

Complete Example Program

Python – statistics-basics.py
import statistics as stats

marks = [80, 85, 85, 90, 100]
print("Mean:", stats.mean(marks))
print("Median:", stats.median(marks))
print("Mode:", stats.mode(marks))

Expected Output

Mean: 88 Median: 85 Mode: 85

Program Explanation

  • import statistics as stats imports ready-made features from a module/library.
  • marks = [80, 85, 85, 90, 100] stores a value in marks.
  • print("Mean:", stats.mean(marks)) displays information or calculated result on the screen.
  • print("Median:", stats.median(marks)) displays information or calculated result on the screen.
  • print("Mode:", stats.mode(marks)) displays information or calculated result on the screen.

Practical Uses

  • Summarising marks.
  • Understanding average and spread.
  • Supporting ml decisions.

Common Mistakes

  • Analysing data before checking missing values, duplicates and data types.
  • Changing original data without keeping a clean copy.
  • Creating charts without title, labels or explanation.

Practice Tasks

  1. Program ko statistics-basics.py file me type karke run karein.
  2. Values change karke output compare karein.
  3. summarising marks par ek छोटा example banayen.
  4. Logic ko apne words me 5 lines me likhein.

सारांश

Statistics Basics ko tab complete maanenge jab aap iska meaning, example, output aur practical use clearly explain kar saken.

← Back to Python Tutorial