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

Questions For Dataframe

This document contains questions about dataframes in Python. It asks about creating dataframes from lists, calculating summary statistics on subsets of dataframes, filling in blanks to achieve a desired output, creating a dataframe from a list of lists with appropriate column headers, how dataframes specify row indexes, and programs to create dataframes from series and ndarrays.

Uploaded by

twinntower.9.11
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)
297 views2 pages

Questions For Dataframe

This document contains questions about dataframes in Python. It asks about creating dataframes from lists, calculating summary statistics on subsets of dataframes, filling in blanks to achieve a desired output, creating a dataframe from a list of lists with appropriate column headers, how dataframes specify row indexes, and programs to create dataframes from series and ndarrays.

Uploaded by

twinntower.9.11
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

Class : XII Sub.

: IP
1. What is Dataframe?
2. Create a dataframe using list of dictionaries.
A B C
0 12 15 66
1 22 23 24

3. Write the output of the following code:


import numpy as n
import pandas as p
A=n.array([23,45,66])
B=n.array([34,55,45])
C= n.array ([90,89,78])
DF=p.DataFrame(A,B,C)
print(DF)
4. Consider DataFrame df as shown below :

weig heig runsscor


name age ht ht ed
0 mayur 15 51 5.1 55
1 anil 16 48 5.2 25
2 viraj 17 49 5.1 71
3 viraj 17 51 5.3 53
mahes
4 h 16 48 5.1 51
5 viraj 17 59 5.3 50

a. Write command to calculate minimum value for each of the row from
subset of dataframe that contains age, weight, height, runsscored
b. Write command to calculate mean for last 3 rows.
5. Write a python statement to fill in the blanks so that the given output of is
achieved:
import pandas as p
d={‘Rollno’: [101,102,103,104] , ‘Eco’ : [50,60,60,50] , ‘Bst’ : [50,70,60,80]}
Df=p.DataFrame(d)
Df1= _____________________________
Print(Df1)

Output:
Rollno 410
Eco 220
Bst 260
Dtype: int64
6. Write a python code to create a dataframe with appropriate headings from
the list given below :
['S101', 'Amy', 70], ['S102', 'Bandhi', 69], ['S104', 'Cathy', 75],
['S105','Gundaho', 82]
7. How does dataframe specify indexes to its data rows?
8. If a datframe has following values the what will be the output of different
statements:
Max speed shield

Viper 1 2

cobra 4 5

Sidevinder 7 8
a. df.loc['viper']
b. df.loc['cobra':'viper', 'max_speed']
9. Write a program to create a dataframe salesman using the series
sales_person which stored saleman names and quantity of sales of previous
month.
10. Write a program to create a dataframe df_nda ndArray that stores letters
and words starting from 'g' to 'p'. (The first column stores letter and the
second column stores the words starting with that letter.)

You might also like