Professional Documents
Culture Documents
Assignment-2 Pandas Data Frame
Assignment-2 Pandas Data Frame
: 01
Write a Pandas program to get the first 3 rows of a given Data Frame. Sample Python dictionary data
and list labels:
Exam_data = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura',
'Kevin', 'Jonas'], 'score': [12.5, 9, 16.5, 8, 9, 20, 14.5, 9.5, 8, 19], 'attempts': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1],
'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']} labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
Exercise 2
Write a Pandas program to select the specified columns and rows from a given DataFrame. Select 'name'
and 'score' columns in rows 1, 3, 5, 6 from the following data frame. Sample DataFrame:
exam_data = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura',
'Kevin', 'Jonas'], 'score': [12.5, 9, 16.5, 8, 9, 20, 14.5, 9.5, 8, 19], 'attempts': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1],
'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']} labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
Exercise 3
Read the table for the Cricket World Cup Winner list available in the internet source
[https://www.careerpower.in/cricket-world-cup-winners-list.html ]. The website contains three tables.
Read the third table which contain list of T20 world cup winners from 2007 onwards. Export the table
data frame to an excel file. Display the details of T20 world cup where venue was INDIA.
Exercise 4
Download the excel file from the given Google drive link
[https://drive.google.com/drive/folders/1A7LGfxuiphqYDc15nAV86u9NmSKg7PyY?usp=sharing] to your
hard disc , Read the excel file from the hard disc, Assign the label [student name, registration number,
attendance, project mark, CGPA]. Sort the CGPA values and select top 5 students. Display the top5
student’s registration number, attendance and marks on an html file.
Question 5:
Download the database file (covid19_odisha.db) available on the Google drive link
[https://drive.google.com/drive/folders/17iiy9dN2Fk2QOH27d8WUsJMovIN8nO_2?usp=sharing]. The
database file regarding covid19 updates of districts of Odisha on dated 8th August. Download the file to
your local disc. Read the database file using PANDAS read_sql and display the content. Publish the
details of Red zone district on a webpage (.html). Assume Red zone district are those having confirmed
cases more than 1000.
Question 6:
After reading the CSV file, save only attributes of Iris-Setosa type to another Dataframe. Perform the
mean of each column attributes of IRIS Setosa and Display the mean values