Latest update Android YouTube

A Quick Recap Maths (Statistics) with Python | Statistics | it2edu

A Quick Recap Maths (Statistics) via Python | Python | Statistics | it2edu, mean, mode, median, range, standerd deviation, graph, min, max
Admin

 

A Quick Recap Maths (Statistics)  with Python | Statistics | it2edu



Here we will see the practice example of following formal using in Python-

  1. Mean
  2. Median
  3. Mode
  4.  Variance
  5. Standard Deviation 
  6. Range
  7. Comparision etc.

==========================================================

# A Quick Recap Maths (Statistics)  with Python | Statistics | it2edu
# Here we will see the practice example of following formal using in Python-
    # Mean
    # Median
    # Mode
    # Variance
    # Standard Deviation
    # Range
    # Comparision etc.
# ==========================================================

import statistics
from matplotlib import pyplot as plt
from statistics import*
import statistics as statistics

# Derive Data

A=[10,15,8.9,6,8,16,11.5,9.3,7,14]
B=[14.2,13.2,12,14,15.3,13.5,13,11,9,13.1]
print("Given Data A = ",A)
print("Given Data B = ",B)


####################################

#finding mean  of A and B

x=statistics.mean(A)

y=statistics.mean(B)

print("Mean of A = ",x)

print("Mean of B = ",y)



#################################

#comparing mean of A and B

if x> y:

      print("Mean of A is greater than B. ")

elif x == y:

  print("Mean of A and B are equal.")

else:
    print("Mean of B is greater than A. ")



#################################

# finding median of A and B

print("Median of A:",statistics.median(A))

print("Median of B:",statistics.median(B))



#################################

#finding mode of A and B

print("Mode of A = ",statistics.mode(A))

print("Mode of B = ",statistics.mode(B))



################################

#finding minimum and maximum  of A and B

#minimum

print("Minimum of A = ",min(A))

print("Minimum of B = ",min(B))

#maximum

print("Maximum of A = ",max(A))

print("Maximum of B = ",max(B))


##############################

#finding Standard deviation of A and B

p=statistics.stdev(A)

q=statistics.stdev(B)

print("Standard deviation of A = ",p)

print("Standard deviaion of B = ",q)



#############################

#comparing the standard deviation of A and B

if p> q:

      print("Standard deviation  of A is greater than B.")

elif p == q:

  print("Standard deviation of A and B are equal.")

else:

  print("Standard deviation of B is greater than A.")



##############################

#finding variance of A and B

print("variance of A = ",statistics.variance(A))

print("variance of B = ",statistics.variance(B))



###############################

#finding range of A and B

for i in range(len(A)):

    print("Range of A = ",A[i])

for i in range(len(B)):
    print("Range of B = ",B[i])
# graph

# fig,ax=plt.subplots(figsize=(10,7))

# ax.hist(A,bins=[0,25,50,75,100])


plt.plot(A, B,)
plt.title('Graph representation of A and B ')
plt.ylabel('Data of B')
plt.xlabel('Data of A')

plt.show()


1 comment

  1. Nice Work👍
Feel free to ask your query...
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.