Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views2 pages

Pandas PQ

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Pandas PQ

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Data Loading & Inspection

1. Load a CSV file named students.csv into a DataFrame and display the first 5

rows.

2. Print total number of rows and columns in the DataFrame.

3. Display only the last 3 rows of the data.

4. Show the column names and data types of all columns using .info().

5. Print summary statistics (mean, min, max, etc.) of numeric columns

using .describe().

📊 2. DataFrame Creation & Modification

6. Create a DataFrame of students with columns: Name, Maths, Science,

English and add a column Total.

7. Add a new column Average which is the average of the three marks.

8. Create a column Result, assign "Pass" if average ≥ 35, else "Fail".

9. Replace all "Fail" values in the Result column with "Needs Improvement".

10. Drop the English column from the DataFrame using .drop().

🔍 3. Filtering and Sorting

11. Display only the students who scored more than 90 in Science.

12. Show students who have Total marks greater than or equal to 250.
13. Sort the DataFrame by Total in descending order.

14. Sort students first by Result (Pass/Fail), then by Name alphabetically.

15. Display only those students whose names start with the letter "A".

🔁 4. Grouping and Aggregation

16. Group students by a column Class and find the average Maths marks in each

class.

17. Find the number of students in each result category (Pass / Needs

Improvement).

18. Count how many students scored exactly 100 in any subject.

📤 5. File I/O and Exporting Data

19. Read a JSON file products.json and display the product names with price >

500.

20. Export your modified student DataFrame to a new CSV file named result.csv.

You might also like