CREATE A SERIES OBJECT MARKS, CONTAINING MARKS OF 6 STUDENTS. WRITE A PYTHON PROGRAM TO SORT THE VALUES OF A SERIES OBJECT MARKS IN ASCENDING ORDER AND DESCENDING ORDER AND STORE IT INTO SERIES OBJECT ASCMARKS AND DESCMARKS RESPECTIVELY.
Solution :-
import pandas as pd mrk = [98,49,86,78,96,59] names = [“Neel”,”Nitin”,”Mohan”,”Ram”,”Manish”,”Suresh”] marks=pd.Series(mrk,names) print(“marks”) print(marks) ascMarks = marks.sort_values(ascending=True) print(“Marks after sorting in Asceding order:-“) print(ascMarks) descMarks=marks.sort_values(ascending=False) print(“Marks after sorting in Descending order:-“) print(descMarks)