Statistical Data Analysis - Ipynb - Colaboratory
Statistical Data Analysis - Ipynb - Colaboratory
ipynb - Colaboratory
Choose Files No file chosen Upload widget is only available when the cell has been executed in
the current browser session. Please rerun this cell to enable.
Saving IBM-313 Marks xlsx to IBM-313 Marks xlsx
S.No. MTE (25) Mini Project (25) Total (50) ETE (50) Total
0 1 5.00 20 25.00 12.0 37.00
1 2 11.05 20 31.05 26.0 57.05
2 3 8.10 20 28.10 14.0 42.10
3 4 6.00 10 16.00 13.0 29.00
4 5 11.35 20 31.35 17.0 48.35
.. ... ... ... ... ... ...
74 75 12.05 10 22.05 20.0 42.05
75 76 12.25 10 22.25 28.0 50.25
76 77 1.75 10 11.75 NaN 0.00
77 78 3.00 10 13.00 NaN 0.00
78 79 5.80 10 15.80 12.0 27.80
table.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 79 entries, 0 to 78
Data columns (total 6 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 S.No. 79 non-null int64
1 MTE (25) 79 non-null float64
2 Mini Project (25) 79 non-null int64
3 Total (50) 79 non-null float64
4 ETE (50) 77 non-null float64
5 Total 79 non-null float64
dtypes: float64(4), int64(2)
memory usage: 3.8 KB
x = table['Total']
np.mean(x)
46.90632911392405
np.median(x)
45.0
import scipy
from scipy import stats
m1=stats.mode(x)
print(m1)
ModeResult(mode=array([0.]), count=array([2]))
<ipython-input-7-625da3d35865>:3: FutureWarning: Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mo
m1=stats.mode(x)
li = [1, 2, 3, 3, 2, 2, 2, 1, 2]
print (stats.mode(li))
https://colab.research.google.com/drive/1apFRrvkiXDm2KVY7jq9fPctuxdxi8D-G#scrollTo=epYJ7wb4zlRr&printMode=true 1/6
5/17/23, 1:23 AM Copy of Statistical data analysis.ipynb - Colaboratory
ModeResult(mode=array([2]), count=array([5]))
<ipython-input-8-5c66091584e9>:2: FutureWarning: Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mo
print (stats.mode(li))
a = np.array([1,2,3,4,5])
p = np.percentile(a,50)
print (p)
3.0
Ram
65
2.5
10
12
14
16
18
10,12,14,16,18,
FUNCTIONS IN PYTHON
def greet():
print("Hi")
print("Good Evening")
greet()
Hi
Good Evening
add(10,4)
14
data = [1,3,4,463,2,3,6,8,9,4,254,6,72]
min(data), max(data)
(1, 463)
data = [1,3,4,463,2,3,6,8,9,4,254,6,72]
def min_and_max(data): \
#Creates a function min_and_max which retrns the minimum and maximum values of array.
min_val = min(data)
max_val = max(data)
https://colab.research.google.com/drive/1apFRrvkiXDm2KVY7jq9fPctuxdxi8D-G#scrollTo=epYJ7wb4zlRr&printMode=true 2/6
5/17/23, 1:23 AM Copy of Statistical data analysis.ipynb - Colaboratory
min_and_max(data)
(1, 463)
def rangeef(data):
min_val = min(data)
max_val = max(data)
rangeef (data)
462
Quartile
a = np.array([1,2,3,4,5])
q1 = np.percentile(a,25)
print (q1)
2.0
a = np.array([1,2,3,4,5])
q2 = np.percentile(a,50)
print (q2)
3.0
a = np.array([1,2,3,4,5])
q3 = np.percentile(a,75)
print (q3)
4.0
IQ = q3 - q1
IQ
2.0
Variance
np.var(x)
262.7814789296587
import statistics
statistics.pstdev(x)
16.210536046955966
np.std(x)
16.210536046955966
Skewness
0.10226407464884266
https://colab.research.google.com/drive/1apFRrvkiXDm2KVY7jq9fPctuxdxi8D-G#scrollTo=epYJ7wb4zlRr&printMode=true 3/6
5/17/23, 1:23 AM Copy of Statistical data analysis.ipynb - Colaboratory
Box Plot
table.describe()
S.No. MTE (25) Mini Project (25) Total (50) ETE (50) Total
https://colab.research.google.com/drive/1apFRrvkiXDm2KVY7jq9fPctuxdxi8D-G#scrollTo=epYJ7wb4zlRr&printMode=true 4/6
5/17/23, 1:23 AM Copy of Statistical data analysis.ipynb - Colaboratory
X :
[ 1.13126468 -2.2362244 4.36431696 ... -0.65830856 1.24609437
-1.98773246]
https://colab.research.google.com/drive/1apFRrvkiXDm2KVY7jq9fPctuxdxi8D-G#scrollTo=epYJ7wb4zlRr&printMode=true 5/6
5/17/23, 1:23 AM Copy of Statistical data analysis.ipynb - Colaboratory
https://colab.research.google.com/drive/1apFRrvkiXDm2KVY7jq9fPctuxdxi8D-G#scrollTo=epYJ7wb4zlRr&printMode=true 6/6