Questions For Dataframe
Questions For Dataframe
: IP
1. What is Dataframe?
2. Create a dataframe using list of dictionaries.
A B C
0 12 15 66
1 22 23 24
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.)