The Story That Starts Everythingवह कहानी जहाँ से सब शुरू होता है一切从这个故事开始
It is 7 am on a Monday. A hospital manager walks into her office and finds a spreadsheet with 50,000 rows — every patient visit from the past year. Name, age, diagnosis, treatment, cost, duration, outcome. Her board meeting starts in one hour and they want to know: how is the hospital performing?
सोमवार सुबह के 7 बजे हैं। एक hospital manager अपने office में आती है और 50,000 rows वाली एक spreadsheet पाती है — पिछले साल की हर patient visit. नाम, उम्र, diagnosis, treatment, cost, duration, outcome. एक घंटे में उनकी board meeting है और board जानना चाहता है: hospital कैसा perform कर रहा है?
周一早上 7 点。一位医院经理走进办公室,看到一张 50,000 行的电子表格 —— 过去一年的每一次就诊记录:姓名、年龄、诊断、治疗、费用、时长、结果。一小时后董事会开会,他们想知道:医院的表现如何?
She cannot read 50,000 rows in an hour. She cannot hand the spreadsheet to the board. What she needs is a way to compress 50,000 data points into a handful of meaningful numbers — numbers that tell the story of the data without showing every detail.
वह एक घंटे में 50,000 rows नहीं पढ़ सकती। वह spreadsheet board को नहीं थमा सकती। उन्हें एक ऐसा तरीका चाहिए जो 50,000 data points को कुछ मतलब वाली संख्याओं में समेट दे — ऐसी संख्याएँ जो हर detail दिखाए बिना data की कहानी बताएँ।
她不可能在一小时内读完 50,000 行,也不能把表格直接交给董事会。她需要一种方法,把 50,000 个数据点压缩成几个有意义的数字 —— 不展示每个细节,却能讲出数据的故事。
That is exactly what Descriptive Statistics does.
यही काम Descriptive Statistics करता है।
这正是描述统计(Descriptive Statistics)要做的事。
Average patient age: 47. Most common diagnosis: respiratory (28%). Average hospital stay: 3.2 days. Average treatment cost: £1,840. Patient outcome success rate: 94.3%. Longest wait time recorded: 18 hours. These six numbers summarise 50,000 rows. That is descriptive statistics.
Patients की औसत उम्र: 47. सबसे आम diagnosis: respiratory (28%). Hospital में औसत stay: 3.2 दिन। औसत treatment cost: £1,840. Patient outcome success rate: 94.3%. सबसे लंबा दर्ज wait time: 18 घंटे। ये छह संख्याएँ 50,000 rows का सार हैं। यही descriptive statistics है।
患者平均年龄:47 岁。最常见诊断:呼吸系统疾病(28%)。平均住院:3.2 天。平均治疗费用:£1,840。治疗成功率:94.3%。最长等待时间记录:18 小时。这六个数字概括了 50,000 行数据。这就是描述统计。
What is Descriptive Statistics?Descriptive Statistics क्या है?什么是描述统计?
Descriptive statistics is the branch of statistics that organises, summarises, and describes a dataset using numbers and charts. It does not make predictions. It does not test hypotheses. It simply answers one question: What does this data look like?
Descriptive statistics, statistics की वह शाखा है जो numbers और charts से किसी dataset को व्यवस्थित करती, सारांश बनाती और उसका वर्णन करती है। यह predictions नहीं करती। यह hypotheses test नहीं करती। यह बस एक सवाल का जवाब देती है: यह data कैसा दिखता है?
描述统计是统计学的一个分支,用数字和图表来整理、概括和描述数据集。它不做预测,也不检验假设,只回答一个问题:这些数据长什么样?
- Mean, Median, ModeMean, Median, Mode均值、中位数、众数
- Where is the centre?केंद्र कहाँ है?中心在哪里?
- What is typical?आम value क्या है?典型值是多少?
- Range, Variance, Std DevRange, Variance, Std Dev极差、方差、标准差
- How spread out is it?कितना फैला हुआ है?分布有多散?
- How consistent is it?कितना एक जैसा है?有多稳定?
- Skewness, KurtosisSkewness, Kurtosis偏度、峰度
- What shape is it?इसका shape क्या है?是什么形状?
- Are there outliers?क्या outliers हैं?有没有离群点?
Descriptive statistics describes the data you have. Inferential statistics uses that data to make predictions or draw conclusions about data you have not seen. Descriptive always comes first — you cannot make good inferences from data you have not properly described.
Descriptive statistics आपके पास मौजूद data का वर्णन करता है। Inferential statistics उसी data से उस data के बारे में predictions या निष्कर्ष निकालता है जो आपने नहीं देखा। Descriptive हमेशा पहले आता है — जिस data का ठीक से वर्णन नहीं किया, उससे अच्छे inferences नहीं निकल सकते।
描述统计描述你手上的数据。推断统计用这些数据去预测或推断你没见过的数据。描述永远在先 —— 没有好好描述过的数据,做不出好的推断。
The Four Types of DataData के चार Types四种数据类型
Before you can choose which descriptive statistic to calculate, you must know what type of data you are working with. The wrong statistic on the wrong data type produces meaningless results.
कौन सी descriptive statistic निकालनी है, यह चुनने से पहले आपको पता होना चाहिए कि आप किस type के data पर काम कर रहे हैं। ग़लत data type पर ग़लत statistic बेमतलब नतीजे देती है।
在选择计算哪种描述统计量之前,你必须先知道手上是什么类型的数据。在错误的数据类型上用错误的统计量,结果毫无意义。
All data falls into one of four types, arranged in a hierarchy from least to most informative:
हर data चार types में से किसी एक में आता है, जो कम से ज़्यादा जानकारी वाले क्रम में रखे गए हैं:
所有数据都属于以下四种类型之一,按信息量从少到多排成一个层级:
Examples: blood type (A, B, AB, O), eye colour, country of birth, programming language, gender, car brand.
Valid stats: Mode, frequency, percentage. You cannot calculate a mean blood type.
उदाहरण: blood type (A, B, AB, O), आँखों का रंग, जन्म का देश, programming language, gender, car brand.
सही stats: Mode, frequency, percentage. Blood type का mean नहीं निकाला जा सकता।
例子:血型(A、B、AB、O)、眼睛颜色、出生国家、编程语言、性别、汽车品牌。
有效统计量:众数、频数、百分比。你算不出“平均血型”。
Examples: customer satisfaction (1–5 stars), pain scale (1–10), education level (GCSE, A-Level, Degree, Masters), film ratings (Poor, Average, Good, Excellent).
Valid stats: Mode, median, percentiles. The gap between 1 star and 2 stars is not necessarily the same as the gap between 4 stars and 5 stars — so mean is unreliable.
उदाहरण: customer satisfaction (1–5 stars), pain scale (1–10), education level (GCSE, A-Level, Degree, Masters), film ratings (Poor, Average, Good, Excellent).
सही stats: Mode, median, percentiles. 1 star और 2 stars का अंतर ज़रूरी नहीं कि 4 और 5 stars के अंतर जितना हो — इसलिए mean भरोसेमंद नहीं।
例子:客户满意度(1–5 星)、疼痛评分(1–10)、学历(GCSE、A-Level、学士、硕士)、电影评级(差、一般、好、优秀)。
有效统计量:众数、中位数、百分位数。1 星到 2 星的差距不一定等于 4 星到 5 星 —— 所以均值不可靠。
Examples: temperature in Celsius or Fahrenheit, IQ scores, calendar year (year 0 does not mean "no time"), SAT scores.
Valid stats: Mean, median, mode, std dev, correlation. You can say 30°C is 10° hotter than 20°C, but you cannot say 30°C is "twice as hot" as 15°C. Only ratios of differences are meaningful, not ratios of values.
उदाहरण: Celsius या Fahrenheit में तापमान, IQ scores, calendar year (year 0 का मतलब "कोई समय नहीं" नहीं), SAT scores.
सही stats: Mean, median, mode, std dev, correlation. आप कह सकते हैं कि 30°C, 20°C से 10° ज़्यादा गर्म है, पर यह नहीं कि 30°C, 15°C से "दोगुना गर्म" है। सिर्फ़ अंतरों के ratios का मतलब है, values के ratios का नहीं।
例子:摄氏或华氏温度、智商分数、公历年份(公元 0 年不代表“没有时间”)、SAT 分数。
有效统计量:均值、中位数、众数、标准差、相关系数。可以说 30°C 比 20°C 高 10 度,但不能说 30°C 是 15°C 的“两倍热”。只有差值之比有意义,数值之比没有意义。
Examples: height, weight, age, salary, distance, time elapsed, number of purchases, temperature in Kelvin.
Valid stats: All statistics. You can say someone who earns £60,000 earns twice as much as someone earning £30,000. That ratio is meaningful because zero salary means no salary at all.
उदाहरण: height, weight, age, salary, distance, बीता हुआ समय, purchases की संख्या, Kelvin में तापमान।
सही stats: सारी statistics. आप कह सकते हैं कि £60,000 कमाने वाला, £30,000 कमाने वाले से दोगुना कमाता है। यह ratio सही है क्योंकि zero salary का मतलब बिल्कुल कोई salary नहीं।
例子:身高、体重、年龄、薪资、距离、经过的时间、购买次数、开尔文温度。
有效统计量:所有统计量。可以说年薪 £60,000 的人收入是年薪 £30,000 的人的两倍。这个比值有意义,因为零薪资就是完全没有薪资。
Treating ordinal data as if it were ratio. A customer satisfaction survey numbered 1 to 10 looks like numbers, but the difference between a 3 and a 4 is not the same emotional distance as between a 8 and a 9. Calculating a mean satisfaction score of 7.3 and treating it like a precise measurement is a common and misleading error in business reporting.
Ordinal data को ratio की तरह मानना। 1 से 10 तक numbered customer satisfaction survey संख्याओं जैसा दिखता है, पर 3 और 4 के बीच का भावनात्मक अंतर, 8 और 9 के बीच के अंतर जितना नहीं होता। 7.3 का mean satisfaction score निकालकर उसे सटीक माप की तरह मानना business reporting की एक आम और गुमराह करने वाली ग़लती है।
把定序数据当成定比数据。1 到 10 分的客户满意度调查看起来是数字,但 3 分到 4 分的情感距离,和 8 分到 9 分并不一样。算出 7.3 的平均满意度,再把它当作精确测量值,是商业报告中常见而又误导人的错误。
Data Types — Real Examples Side by SideData Types — असली उदाहरण साथ-साथ数据类型 — 真实例子对照
| TypeType类型 | Real exampleअसली उदाहरण真实例子 | Can rank?Rank कर सकते हैं?能排序? | Equal gaps?बराबर अंतर?等间隔? | True zero?True zero?真正零点? | Best statसबसे अच्छी stat最佳统计量 |
|---|---|---|---|---|---|
| Nominal | Favourite colour: Red, Blue, Greenपसंदीदा रंग: Red, Blue, Green最喜欢的颜色:红、蓝、绿 | Noनहीं否 | Noनहीं否 | Noनहीं否 | Mode |
| Ordinal | Movie rating: ★ ★★ ★★★ ★★★★ ★★★★★Movie rating: ★ ★★ ★★★ ★★★★ ★★★★★电影评分:★ ★★ ★★★ ★★★★ ★★★★★ | Yesहाँ是 | Noनहीं否 | Noनहीं否 | Median |
| Interval | Temperature: 0°C, 10°C, 20°C, 30°Cतापमान: 0°C, 10°C, 20°C, 30°C温度:0°C、10°C、20°C、30°C | Yesहाँ是 | Yesहाँ是 | Noनहीं否 | Mean |
| Ratio | Salary: £0, £25k, £50k, £100kSalary: £0, £25k, £50k, £100k薪资:£0、£25k、£50k、£100k | Yesहाँ是 | Yesहाँ是 | Yesहाँ是 | Mean + allMean + सब均值 + 全部 |
Another way to remember it — the thermometer testयाद रखने का एक और तरीका — thermometer test另一种记法 —— 温度计测试
Ask: does zero mean "none of this thing exists"?
0°C — does it mean "no temperature"? No — it still has temperature, just at the freezing point of water. So temperature in Celsius is Interval.
0 kg — does it mean "no weight"? Yes — zero weight means nothing is there. So weight is Ratio.
0 goals scored — does it mean "no goals"? Yes. So goals scored is Ratio.
पूछें: क्या zero का मतलब है "यह चीज़ बिल्कुल नहीं है"?
0°C — क्या इसका मतलब "कोई तापमान नहीं"? नहीं — तापमान अब भी है, बस पानी के जमने के बिंदु पर। इसलिए Celsius में तापमान Interval है।
0 kg — क्या इसका मतलब "कोई वज़न नहीं"? हाँ — zero वज़न का मतलब वहाँ कुछ नहीं। इसलिए वज़न Ratio है।
0 goals — क्या इसका मतलब "कोई goal नहीं"? हाँ। इसलिए goals की संख्या Ratio है।
问自己:零是否表示“这个东西完全不存在”?
0°C —— 是“没有温度”吗?不是 —— 仍然有温度,只是处在水的冰点。所以摄氏温度是定距。
0 kg —— 是“没有重量”吗?是 —— 零重量就是什么都没有。所以重量是定比。
进球数 0 —— 是“没有进球”吗?是。所以进球数是定比。
Population vs Sample — The Most Important DistinctionPopulation vs Sample — सबसे ज़रूरी फ़र्क़总体 vs 样本 — 最重要的区分
Every dataset you will ever work with is either a population or a sample. Getting this wrong leads to the wrong formulas, the wrong conclusions, and sometimes catastrophically bad decisions.
आप जिस भी dataset पर काम करेंगे, वह या तो population होगा या sample. इसमें ग़लती से ग़लत formulas, ग़लत निष्कर्ष, और कभी-कभी बहुत बुरे फ़ैसले होते हैं।
你接触的每个数据集,要么是总体(population),要么是样本(sample)。搞错了,就会用错公式、得出错误结论,有时还会做出灾难性的决定。
Story — the hospital againकहानी — फिर से hospital故事 —— 又是那家医院
The hospital manager has data on every patient visit last year — all 50,000. That is the population for the question "how did we perform last year?" She has every data point. She uses population formulas (divide by N).
Hospital manager के पास पिछले साल की हर patient visit का data है — सारी 50,000. "पिछले साल हमने कैसा perform किया?" सवाल के लिए यही population है। उनके पास हर data point है। वह population formulas इस्तेमाल करती है (N से भाग)।
医院经理拥有去年每一次就诊的数据 —— 全部 50,000 条。对于“我们去年表现如何?”这个问题,这就是总体。她有每一个数据点,所以用总体公式(除以 N)。
But now she wants to know: do patients in general — across the entire NHS — prefer morning or evening appointments? She cannot collect data from every NHS patient. So she surveys 800 patients from her hospital. That 800 is a sample. She uses sample formulas (divide by n−1) and her conclusions come with uncertainty — they might not perfectly reflect all NHS patients.
पर अब वह जानना चाहती है: क्या पूरे NHS के patients आम तौर पर सुबह के appointments पसंद करते हैं या शाम के? वह हर NHS patient का data नहीं जुटा सकती। इसलिए वह अपने hospital के 800 patients का survey करती है। वे 800 एक sample हैं। वह sample formulas इस्तेमाल करती है (n−1 से भाग), और उनके निष्कर्षों में अनिश्चितता रहती है — हो सकता है वे सारे NHS patients को पूरी तरह न दर्शाएँ।
但现在她想知道:整个 NHS 的患者总体上更喜欢上午还是晚上预约?她不可能收集每一位 NHS 患者的数据,于是调查了本院的 800 名患者。这 800 人就是样本。她使用样本公式(除以 n−1),结论也带有不确定性 —— 可能无法完全代表所有 NHS 患者。
[12, 18, 25, 8, 34, 21, 15, 19][12, 18, 25, 8, 34, 21, 15, 19][12, 18, 25, 8, 34, 21, 15, 19](12+18+25+8+34+21+15+19) / 8 = 152 / 8 = 19 minutes
(12+18+25+8+34+21+15+19) / 8 = 152 / 8 = 19 मिनट
(12+18+25+8+34+21+15+19) / 8 = 152 / 8 = 19 分钟
Sample variance: Σ(x−x̄)² / (n−1) = 444 / 7 = 63.4
Sample variance: Σ(x−x̄)² / (n−1) = 444 / 7 = 63.4
样本方差:Σ(x−x̄)² / (n−1) = 444 / 7 = 63.4
If they are a sample from a large hospital — use sample formulas (÷ n−1 = 7). Using the wrong one gives a different variance, different standard deviation, and different conclusions.
अगर ये किसी बड़े hospital का sample हैं — sample formulas इस्तेमाल करें (÷ n−1 = 7)। ग़लत formula से अलग variance, अलग standard deviation और अलग निष्कर्ष मिलते हैं।
如果他们是大医院的一个样本 —— 用样本公式(÷ n−1 = 7)。用错公式,方差、标准差和结论都会不同。
Population vs Sample — More Real-World ExamplesPopulation vs Sample — और असली उदाहरण总体 vs 样本 — 更多真实例子
| Scenarioस्थिति场景 | PopulationPopulation总体 | SampleSample样本 | Type usedइस्तेमाल हुआ type使用类型 |
|---|---|---|---|
| UK general election pollUK general election poll英国大选民调 | All 46 million eligible votersसभी 4.6 करोड़ योग्य मतदाता全部 4,600 万合格选民 | 1,000 people surveyed1,000 लोगों का survey调查 1,000 人 | SampleSample样本 |
| Company employee satisfactionCompany employee satisfaction公司员工满意度 | All 200 employeesसभी 200 employees全部 200 名员工 | All 200 surveyedसभी 200 का survey全部 200 人参与调查 | PopulationPopulation总体 |
| Average height of adult men in UKUK में वयस्क पुरुषों की औसत height英国成年男性平均身高 | ~25 million adult men~2.5 करोड़ वयस्क पुरुष约 2,500 万成年男性 | 500 men measured500 पुरुषों का माप测量 500 人 | SampleSample样本 |
| Netflix monthly views for one filmएक film के Netflix monthly views某部电影的 Netflix 月观看量 | Every view logged in their systemउनके system में दर्ज हर view系统记录的每一次观看 | Every view loggedहर दर्ज view每一次记录的观看 | PopulationPopulation总体 |
| Quality check — chocolate barsQuality check — chocolate bars质检 —— 巧克力棒 | All bars produced (millions)बने हुए सारे bars (लाखों)生产的全部巧克力棒(数百万) | 200 bars tested per shiftहर shift में 200 bars test每班检测 200 根 | SampleSample样本 |
| Exam scores in a class of 3030 छात्रों की class के exam scores30 人班级的考试成绩 | All 30 studentsसभी 30 छात्र全部 30 名学生 | All 30 scoredसभी 30 के अंक全部 30 人的成绩 | PopulationPopulation总体 |
Even if your database has 10 million rows, it is rarely every person who has ever bought your product, used your app, or been affected by your model's decisions. Unless you have genuinely captured every possible case, treat your data as a sample and use sample formulas — divide variance and standard deviation by (n − 1), not n.
भले ही आपके database में 1 करोड़ rows हों, शायद ही कभी वह हर उस व्यक्ति का data होता है जिसने आपका product ख़रीदा, आपका app इस्तेमाल किया, या जिस पर आपके model के फ़ैसलों का असर पड़ा। जब तक आपने सच में हर संभव case न पकड़ा हो, अपने data को sample मानें और sample formulas इस्तेमाल करें — variance और standard deviation में n नहीं, (n − 1) से भाग दें।
即使你的数据库有 1,000 万行,也很少恰好包含所有买过你产品、用过你应用或受你模型决策影响的人。除非你真的覆盖了所有可能的情况,否则就把数据当作样本,使用样本公式 —— 方差和标准差除以 (n − 1),而不是 n。
Python — Identifying Data Types and BasicsPython — Data Types पहचानना और बुनियादी बातेंPython — 识别数据类型与基础
Loading and inspecting data typesData load करना और उसके types देखना加载并查看数据类型
import pandas as pd
import numpy as np
# Create a realistic hospital dataset
data = {
'patient_id': [1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008],
'blood_type': ['A', 'O', 'B', 'AB', 'O', 'A', 'O', 'B'], # Nominal
'pain_level': [3, 7, 5, 2, 8, 4, 6, 1], # Ordinal (1–10 scale)
'temperature_c': [37.1, 38.4, 36.9, 39.2, 37.8, 36.5, 38.1, 37.3], # Interval
'weight_kg': [72, 85, 61, 93, 78, 55, 88, 70], # Ratio
'stay_days': [2, 5, 1, 8, 3, 1, 4, 2], # Ratio
}
df = pd.DataFrame(data)
print(df.dtypes)
print("\n", df.head())
Descriptive stats for each data typeहर data type के लिए descriptive stats每种数据类型的描述统计
import pandas as pd
from scipy import stats
data = {
'blood_type': ['A','O','B','AB','O','A','O','B','A','O'],
'pain_level': [3, 7, 5, 2, 8, 4, 6, 1, 5, 7],
'temperature_c': [37.1, 38.4, 36.9, 39.2, 37.8, 36.5, 38.1, 37.3, 37.0, 38.9],
'weight_kg': [72, 85, 61, 93, 78, 55, 88, 70, 66, 82],
}
df = pd.DataFrame(data)
# ── Nominal: blood_type — only mode and frequency make sense ──
print("=== Nominal: Blood Type ===")
print(df['blood_type'].value_counts())
print(f"Mode: {df['blood_type'].mode()[0]}")
# ── Ordinal: pain_level — mode and median are appropriate ──
print("\n=== Ordinal: Pain Level ===")
print(f"Mode: {df['pain_level'].mode()[0]}")
print(f"Median: {df['pain_level'].median()}")
# ── Interval/Ratio: temperature and weight — full stats ──
print("\n=== Ratio: Weight (kg) ===")
print(f"Mean: {df['weight_kg'].mean():.1f} kg")
print(f"Median: {df['weight_kg'].median():.1f} kg")
print(f"Std Dev: {df['weight_kg'].std():.1f} kg") # sample std (ddof=1)
print(f"Min: {df['weight_kg'].min()} kg")
print(f"Max: {df['weight_kg'].max()} kg")