np.histogram() से Histogram बनाना
एक histogram कुछ भी draw किए बिना count करता है कि कितनी values हर range (bin) में आती हैं।
In this page:
Syntax
counts, bin_edges = np.histogram(arr, bins=number_of_bins)
np.histogram()
np.histogram(a, bins) दो arrays return करता है: प्रति bin counts और bin edges, जो counts से एक ज़्यादा लंबी है। bins एक integer या explicit edges हो सकती है। यह एक histogram plot के पीछे के numbers provide करता है।
Note:
counts की बजाय probabilities पाने के लिए density=True set करें।
उदाहरण: np.histogram()
import numpy as np
a = np.array([1, 2, 2, 3, 3, 3, 4, 4, 5, 9])
counts, edges = np.histogram(a, bins=[0, 3, 6, 10])
print(counts)
print(edges)
# Output:
# [3 6 1]
# [ 0 3 6 10]
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. #}
आम गलतियां
- यह भूल जाना कि edges में counts से एक ज़्यादा item है
- एक plot appear होने की उम्मीद करना
- बहुत कम या बहुत ज़्यादा bins इस्तेमाल करना
चैप्टर सारांश
- Counts और edges return करता है
- Edges counts से एक लंबी हैं
- bins एक number या list हो सकती है
- density normalise करता है
🔒
Chapter Quiz — Complete all 6 topics to unlock
0/6 topics done
Complete these topics first: