Advertisement
ShrekOP

Assg2

Dec 14th, 2022 (edited)
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import numpy as np
  2. from scipy.stats import iqr
  3. import pandas as pd
  4.  
  5. data = pd.read_csv("Dataset/telecom_churn.csv")
  6.  
  7. print(data.shape)
  8.  
  9. print(data.info())
  10.  
  11. data
  12.  
  13. data.min()
  14.  
  15. data.max()
  16.  
  17. #mean value of all attribute
  18. data.mean()
  19.  
  20. #mean value of individual attribite for coluumn
  21. data.loc[:,'account length'].mean()
  22.  
  23. #mean value for first five lines
  24. data.mean(axis = 1)[0:5]
  25.  
  26. #median value of all attribute
  27. data.median()
  28.  
  29. data.loc[:, 'area code'].median()
  30.  
  31. data.median(axis=1)[0:5]
  32.  
  33. data.mode()
  34.  
  35. data.std()
  36.  
  37. data.std(axis = 0)[1:5]
  38.  
  39. print(data.loc[:,'area code'].std())
  40.  
  41. data.var()
  42.  
  43. #Interquartile Range (IQR)
  44. # The Interquartile Range (IQR) is a measure of statistical dispersion, and is calculated as the difference
  45. # between the upper quartile (75th percentile) and the lower quartile (25th percentile).
  46. iqr(data['area code'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement