If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
python में statistics module का variance() method का use sample variance calculate करने के लिए किया जाता है।
variance , variability का एक measure है जिसे mean / average से squared deviations का average लेकर calculate किया जाता है।
Variability बताती है कि किसी data set में data points आपस में और center of a distribution से कितने दूर हैं।
variance (σ2) हमें बताता है कि किसी specific population में data points कैसे फैले हुए हैं। यह population में प्रत्येक data point से mean ,square तक की दूरी का average है।
Sample Variance =
बैसे तो sample variance , population variance का estimate है , इसे तब use करते हैं जब population variance ज्यादा problematic हो। इसके अलावा मैं difference है कि population variance में sum of squared deviation को n से divide किया जाता है , जबकि sample variance में n-1 से। जहाँ n = number of data points in data set.
statistics.variance(data)
data | required : data जिसका हमें Sample Variance calculate करना है , आप इसमें values की (list, tuple) pass कर सकते हैं।
Return value : pass की गयी values के according value (Integer/float) return होती है।
# Import statistics Library.
# Import statistics Library.
import statistics
#using list.
print(statistics.variance([2,3,4,5,6,7,7,5,12]))
print(statistics.variance([11,22,23,1,23]))
print(statistics.variance([23,2,12,23,3]))
C:\Users\Rahulkumar\Desktop\python>python test_variance.py 8.5 96 105.30000000000001
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook