Techno Main Salt Lake
EM-4/1, Sector V, Bidhannagar,
Kolkata, West Bengal 700091
Department: CSE (AI & ML)
Year: 2nd Semester: 4th
PYTHON II LAB (PCCAIML492)
Assignment 3
The Iris Dataset contains four features (length and width of sepals and petals) of 50 samples
of three species of Iris (Iris setosa, Iris virginica and Iris versicolor). Read the Iris dataset
(iris.csv) using pandas and data frame. Write a python program to do the following operations
on it.
1. Print the data frame.
2. Display top 5 rows.
3. Compute statistical analysis on the data frame.
4. Display 10 random sample rows.
5. Display the number of columns and names of the columns.
6. Print the shape of the dataset.
7. Fetch data from 5th row to 10th row.
8. Display data for two columns: petal. length and petal. width
9. Counting the number of counts of each variety.
10. Display only those rows whose variety is Setosa.
11. Calculate the sum, mean and mode of a particular column (say petal. length).
12. Extract minimum and maximum value from a column (say petal. length).
13. Add a column (say total_value) to the dataset which will display the sum of the integer values
of each row.
14. Rename the column name from variety to variety1 and reverse.
15. Remove the column 'total_value'.
16. Delete the first row of the data frame.
17. Delete the last row of the data frame.
18. Check if a value exists in data frame or not.
19. Check if a value exists in a particular column or not.
20. Write the data frame to another csv file.