MADHAV INSTITUTE OF TECHNOLOGY & SCIENCE, GWALIOR
(A Govt. Aided UGC Autonomous Institute, Affiliated to RGPV, Bhopal)
NAAC Accredited with A++ Grade
Department of Computer Science and Engineering
Course Title: Data Science Course Code: 2290501
Assignment-4
Data Analysis (Unit 3)
Instruction: Write Python code.
Question 1:
Topic: Series and DataFrame
Problem: Create a pandas DataFrame named `students` with columns 'Name',
'Age', and 'Grade' containing the following data:
| Name | Age | Grade |
|---------|-----|-------|
| Alice | 25 | 88 |
| Bob | 30 | 75 |
| Charlie | 22 | 92 |
| David | 35 | 68 |
| Eva | 28 | 90 |
Question 2:
Topic: Dropping Entries
Dr. Rohit Agrawal
MADHAV INSTITUTE OF TECHNOLOGY & SCIENCE, GWALIOR
(A Govt. Aided UGC Autonomous Institute, Affiliated to RGPV, Bhopal)
NAAC Accredited with A++ Grade
Department of Computer Science and Engineering
Problem: Remove the row with 'Name' equal to 'David' from the `students`
DataFrame.
Question 3:
Topic: Indexing, Selection, and Filtering
Problem: Select and display the 'Name' and 'Grade' columns for students with an
'Age' greater than 25.
Question 4:
Topic: Function Application and Mapping
Problem: Create a new column 'Grade_Squared' that contains the square of each
student's 'Grade'.
Question 5:
Topic: Sorting and Ranking
Problem: Sort the `students` DataFrame by 'Grade' in descending order.
Dr. Rohit Agrawal
MADHAV INSTITUTE OF TECHNOLOGY & SCIENCE, GWALIOR
(A Govt. Aided UGC Autonomous Institute, Affiliated to RGPV, Bhopal)
NAAC Accredited with A++ Grade
Department of Computer Science and Engineering
Question 6:
Topic: Summarizing and Computing Descriptive Statistics
Problem: Calculate and display the mean, standard deviation, skewness, and
kurtosis of the 'Grade' column.
Question 7:
Topic: Unique Values and Value Counts
Problem: Find and display the unique values in the 'Age' column and their
corresponding counts.
Solution:
Question 8:
Topic: Membership
Problem: Check if the name 'Alice' is present in the 'Name' column of the
`students` DataFrame.
Dr. Rohit Agrawal
MADHAV INSTITUTE OF TECHNOLOGY & SCIENCE, GWALIOR
(A Govt. Aided UGC Autonomous Institute, Affiliated to RGPV, Bhopal)
NAAC Accredited with A++ Grade
Department of Computer Science and Engineering
Question 9:
Topic: Reading and Writing Data in Text Format
Problem: Write the `students` DataFrame to a CSV file named 'student_data.csv'.
Question 10:
Topic: Reading and Writing Data in Text Format
Problem: Read the data from the 'student_data.csv' file into a new DataFrame
named 'read_students'.
Dr. Rohit Agrawal