0% found this document useful (0 votes)
2 views

test_dataframe

assignment of dataframe in SQL

Uploaded by

Samaira Gaba
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

test_dataframe

assignment of dataframe in SQL

Uploaded by

Samaira Gaba
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

DATA HANDLING USING PANDAS–1

VERY SHORT ANSWER QUESTIONS

1. What is the significance of Pandas library?

2. Name some common data structures of python’s pandas library?

3. Which platform is required to work on DataFrame?

4. Mention four features of Pandas.

5. What will the output produced by following code”


Stationary = [‘pencils’, ‘notebooks’, ‘scales’, ‘erasers’]
S=pd.series([20,30,52,10],index=stationary)
S2=pd.series([17,13,32,21),index=stationary)
print(S+S2)
S=S+S2
print(S+S2)

6. Find the error in following code fragment:


S2=pd.Series([101,102,102,104])
S2.index=[0,1,2,3,4,5]
S2[5]=220
print(S2)

7. How does dataframe assign row index to its rows in two dimensional dictionaries?

8. What will be the output for the below program?

import pandas as pd
import numpy as np
s = pd.Series(5, index=[10, 11, 12, 13])
print(s)

9. 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.

10. Write a code statement to list the value of a cell in the 5 th row and "item" column from a dataframe
"sales"

11. Write a python statement to create (i) empty series (ii) empty dataframe

12. What is the difference between iloc and loc with respect to dataframe?

13. Write a small python code to drop a row from dataframe labeled as 0.

14. 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.

You might also like