Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

Python Scikit learn: View basic statistical details like percentile, mean, std etc. of iris data

Python Machine learning Iris Basic: Exercise-5 with Solution

Write a Python program to view basic statistical details like percentile, mean, std etc. of iris data.

Sample Solution:

Python Code:

import pandas as pd
data = pd.read_csv("iris.csv")
print(data.describe())

Sample Output:

               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

Python Code Editor:


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to create a 2-D array with ones on the diagonal and zeros elsewhere. Now convert the NumPy array to a SciPy sparse matrix in CSR format.
Next: Write a Python program to get observations of each species (setosa, versicolor, virginica) from iris data.

What is the difficulty level of this exercise?