CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

DataFrame operations (4 Marks Questions)


  1. What is pivoting? Which function of pandas support pivoting? Write the difference between them using Python Programming Example?
  2. Consider the Dataframe(DF1) and write the program for the following:
    Name Year Score Catches
    0 Mohak 2012 10 2
    1 Rajesh 2012 22 2
    2 Freya 2013 11 3
    3 Aditya 2014 32 3
    4 Anika 2014 23 3
    • Sort the dataframe’s rows by score, in descending order
    • Sort the dataframe’s rows by catches and then by score, in ascending order
  3. Consider the above Dataframe(DF1) and write the program for the following:
    • Sort the dataframe’s rows using index
    • Sort the dataframe’s rows descending of index value

  4. Product Name Company Price
    Mixer Bajaj 2000
    Dish Washer Philips 6000
    Egg Beater Bajaj 500
    Mixer Sony 2500
    Dishwasher Philips 6500

    Write a python code to create the above dataframe and get the following output from the above given dataframe.
    Product Name Dish Washer Dishwasher Egg Beater Mixer
    Company
    Bajaj NaN NaN 500 2000
    Philips 6000 6500 NaN NaN
    Sony NaN NaN NaN 2500

  5. Consider the following Dataframe(DF) and write the python program to find the following:
    Name Of Employee Sales Quarter State
    0 Mohak 1000 1 Rajasthan
    1 Vijay 300 1 Panjab
    2 Tapasi 400 1 Gujarat
    3 Mansi 500 1 Goa
    4 Bipin 800 2 Rajasthan
    5 Mohak 1000 2 Gujarat
    6 Vijay 500 2 Panjab
    7 Tapasi 700 2 Gujarat
    8 Mansi 50 2 Rajasthan
    9 Bipin 60 2 Rajasthan
    10 Mohak 1000 3 Rajasthan
    • Find total sales per employee in the above data frame. (Ex:- Mohak sales is 3000)
    • Find total sales by the state in the above data frame(Ex:-Rajasthan sales is 2910 )
  6. Consider the above Dataframe(DF) and write the python program to find the following:
    • Find Max individual sale by State in above dataframe
    • Find Mean, median sales by Each State in above dataframe
  7. Assume data frame DF that contains Data about Payment of parking area with points ‘A1’, ‘A2’, ‘A3’, ‘A4’, ‘A5’ S indexers shown below. give the output of any 4 questions from (i) to (v)

No comments:

Post a Comment