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

Laltesh - Pandas - DataFrame

Uploaded by

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

Laltesh - Pandas - DataFrame

Uploaded by

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

Q8 – Write a Query Create a DataFrame from the following

data representing student details. The columns should


be: 'StudentName', 'Class', 'Marks'. Display the
DataFrame.

Solution:

Output:
Q9 – Write a Query to display only the 'StudentName' and
'Marks' columns for students who scored more than 85.

Solution:

Output:
Q10 – Write a Query to Group the DataFrame by the 'Class'
column and calculate the average marks for each class.
Display the resulting DataFrame.

Solution:

Output:
Q11 – Write a Query to Display the rows of students who
are in Class '12B'.

Solution:

Output:
Q12 – Write a Query to Calculate and display the average
marks of all students in the DataFrame.

Solution:

Output:
Q13 – Write a Query to Create a DataFrame from the
following data and calculate the total marks for each
class by grouping the DataFrame by the 'Class' column.
Display the resulting DataFrame.

Solution:

Output:
Q14 – Write a Query to Create a DataFrame with student
data and write it to a CSV file named [Link]
without the index.

Solution:

Output:
Q15 – Write a Query to Read a CSV file named
[Link] that contains the columns 'StudentName',
'Class', and 'Marks'. Display the first 5 rows of the
DataFrame.

Solution:

Output:

You might also like