You work in XYZ Corporation as a Data Analyst. Your corporation has told you to work with the statistics.Â
1. Create a table in excel, table should have 2 columns named x and y.
a. ‘x’ column should have numbers from 1-5.
b. ‘y’ should have numbers 2,4,5,4,2
c. Now calculate the mean of columns x and y.
d. Calculate the mode of column x.
e. Calculate the standard deviation of column y.
f. Atlast calculate the range of columns x and y separately
import pandas as pd
import numpy as np
import os
df = pd.read_csv("Data.csv")
print(df)
u = np.array(df['x'])
v = np.array(df['y'])
print("Mean of column X: ",np.mean(u))
print("Mean of column Y: ",np.mean(v))
print("Mode: ")
print(df.mode())
print("Standard Deviationof column Y: ",round(np.std(v),2))
print("Range of column X: ",np.min(u),"to",np.max(u))
print("Range of column Y: ",np.min(v),"to",np.max(v))
Comments
Leave a comment