Name :- nisha ambike
Roll No :- 02
Title :- Descriptive Statistics - Measures of Central Tendency and variability (B)
import pandas as pd
import numpy as np
df = pd.read_csv("[Link]")
df
Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm Species
0 1 5.1 3.5 1.4 0.2 Iris-setosa
1 2 4.9 3.0 1.4 0.2 Iris-setosa
2 3 4.7 3.2 1.3 0.2 Iris-setosa
3 4 4.6 3.1 1.5 0.2 Iris-setosa
4 5 5.0 3.6 1.4 0.2 Iris-setosa
... ... ... ... ... ... ...
145 146 6.7 3.0 5.2 2.3 Iris-virginica
146 147 6.3 2.5 5.0 1.9 Iris-virginica
147 148 6.5 3.0 5.2 2.0 Iris-virginica
148 149 6.2 3.4 5.4 2.3 Iris-virginica
149 150 5.9 3.0 5.1 1.8 Iris-virginica
150 rows × 6 columns
[Link]()
Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm Species
0 1 5.1 3.5 1.4 0.2 Iris-setosa
1 2 4.9 3.0 1.4 0.2 Iris-setosa
2 3 4.7 3.2 1.3 0.2 Iris-setosa
3 4 4.6 3.1 1.5 0.2 Iris-setosa
4 5 5.0 3.6 1.4 0.2 Iris-setosa
df['SepalLengthCm'].mean()
5.843333333333334
[Link]()
Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm
count 150.000000 150.000000 150.000000 150.000000 150.000000
mean 75.500000 5.843333 3.054000 3.758667 1.198667
std 43.445368 0.828066 0.433594 1.764420 0.763161
min 1.000000 4.300000 2.000000 1.000000 0.100000
25% 38.250000 5.100000 2.800000 1.600000 0.300000
50% 75.500000 5.800000 3.000000 4.350000 1.300000
75% 112.750000 6.400000 3.300000 5.100000 1.800000
max 150.000000 7.900000 4.400000 6.900000 2.500000
df['SepalLengthCm'].median()
5.8
df['SepalLengthCm'].mode()
0 5.0
Name: SepalLengthCm, dtype: float64
df['SepalLengthCm'].std()
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[1], line 1
----> 1 df['SepalLengthCm'].std()
NameError: name 'df' is not defined
[Link]()
Id 1
SepalLengthCm 4.3
SepalWidthCm 2.0
PetalLengthCm 1.0
PetalWidthCm 0.1
Species Iris-setosa
dtype: object
[Link]()
Id 150
SepalLengthCm 7.9
SepalWidthCm 4.4
PetalLengthCm 6.9
PetalWidthCm 2.5
Species Iris-virginica
dtype: object
df['SepalLengthCm'].std()
0.8280661279778629
Total_num = [Link]('Species')['SepalLengthCm'].min()
Total_num
Species
Iris-setosa 4.3
Iris-versicolor 4.9
Iris-virginica 4.9
Name: SepalLengthCm, dtype: float64
Total_num = [Link]('Species')['SepalLengthCm'].median()
Total_num
Species
Iris-setosa 5.0
Iris-versicolor 5.9
Iris-virginica 6.5
Name: SepalLengthCm, dtype: float64
Total_num = [Link]('Species')['SepalLengthCm'].mean()
Total_num
Species
Iris-setosa 5.006
Iris-versicolor 5.936
Iris-virginica 6.588
Name: SepalLengthCm, dtype: float64
Total_num = [Link]('Species')['SepalLengthCm'].std()
Total_num
Species
Iris-setosa 0.352490
Iris-versicolor 0.516171
Iris-virginica 0.635880
Name: SepalLengthCm, dtype: float64
Loading [MathJax]/jax/output/CommonHTML/fonts/TeX/[Link]