DH Using Pandas-1 VSAQs
DH Using Pandas-1 VSAQs
2. Name some common data structures of python’s pandas library? series and dataframe
9. How does dataframe assign row index to its rows in two dimensional dictionaries? df.index
11. Consider the following python code and write the output for statement S1
import pandas as pd
K=pd.Series([2,4,6,8,10,12,14])
K.quantile([0.50,0.75]) #Statement – S1
12. Hitesh wants to display the last four rows of the dataframe df and has written the following code :
df.tail( )
But last 5 rows are being displayed. Identify the error and rewrite the correct code so that last 4 rows get
displayed.
13. Write a code statement to list the value of a cell in the 5 th row and "item" column from a dataframe
"sales"
14. Write a python statement to create (i) empty series (ii) empty dataframe
15. What is the difference between iloc and loc with respect to dataframe?
16. Write a small python code to drop a row from dataframe labeled as 0.
17. A dataframe studdf stores data about the students stream, marks. A part of it is shown below:
Class Stream Marks
11 Science 95
11 Commerce 80
11 Arts 75
11 Vocational 65
Using the above dataframe, write the command to compute Average marks stream wise.