TGViewer
Data Science & Machine Learning Data Science & Machine Learning @datasciencefun · 77.8K subscribers
Post #3928 4.59K
✅ Python for Data Science: Part-5

📊 Descriptive Statistics, Probability Distributions

1️⃣ Descriptive Statistics with Pandas
Quick way to summarize datasets.

import pandas as pd

data = {"Marks": [85, 92, 78, 88, 90]}
df = pd.DataFrame(data)

print(df.describe()) # count, mean, std, min, max, etc.
print(df["Marks"].mean()) # Average
print(df["Marks"].median()) # Middle value
print(df["Marks"].mode()) # Most frequent value


2️⃣ Probability Basics
Chances of an event occurring (0 to 1)

Tossing a coin
prob_heads = 1 / 2
print(prob_heads) # 0.5

Multiple outcomes example:

from itertools import product

outcomes = list(product(["H", "T"], repeat=2))
print(outcomes) # [('H', 'H'), ('H', 'T'), ('T', 'H'), ('T', 'T')]


3️⃣ Normal Distribution using NumPy Seaborn

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

data = np.random.normal(loc=0, scale=1, size=1000)

sns.histplot(data, kde=True)
plt.title("Normal Distribution")
plt.show()


4️⃣ Other Distributions
• Binomial → pass/fail outcomes
• Poisson → rare event frequency
• Uniform → all outcomes equally likely

Binomial Example:

from scipy.stats import binom

# 10 trials, p = 0.5
print(binom.pmf(k=5, n=10, p=0.5)) # Probability of 5 successes


🎯 Why This Matters
• Descriptive stats help understand data quickly
• Distributions help model real-world situations
• Probability supports prediction and risk analysis

Practice Task:
• Generate a normal distribution
• Calculate mean, median, std
• Plot binomial probability of success

💬 Tap ❤️ for more
  • ❤ 11
More from @datasciencefun
  1. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  2. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  3. Oct 15, 2026Post #4665
  4. Oct 15, 2026Post #4664
  5. Oct 15, 2026Post #4663
  6. Oct 15, 2026Post #4662
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →