← Back to NumPy Course | Chapter 6: Math Operations | Lesson 5 of 7

np.mean/median/std का इस्तेमाल

Quick summary numbers: average, middle value, और data कितना spread out है।

In this page:

  1. np.mean/median/std
Syntax
python
np.mean(arr, axis=axis)
np.median(arr)
np.std(arr)

np.mean/median/std

mean arithmetic average है, median middle value है, और std standard deviation है, spread का एक measure। सब एक axis argument accept करते हैं। np.median सिर्फ एक function है, array method नहीं।

Note: std default से ddof=0 (population) इस्तेमाल करता है; sample standard deviation के लिए ddof=1 pass करें।

उदाहरण: np.mean/median/std

python
import numpy as np

a = np.array([2, 4, 4, 4, 5, 5, 7, 9])
print(a.mean())
print(np.median(a))
print(a.std())
print(a.std(ddof=1).round(3))

# Output:
# 5.0
# 4.5
# 2.0
# 2.138
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. arr.median() call करना जो exist नहीं करता
  2. sample statistics के लिए ddof भूल जाना
  3. integers average करना और एक integer की उम्मीद करना
चैप्टर सारांश
  • mean, median, और std data summarize करते हैं
  • axis direction control करता है
  • Default std population है
  • median सिर्फ np.median है
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.