Read and download free pdf of CBSE Class 12 Informatics Practices Data Handling using Pandas Worksheet. Students and teachers of Class 12 Informatics Practices can get free printable Worksheets for Class 12 Informatics Practices Chapter 2 Data Handling using Pandas in PDF format prepared as per the latest syllabus and examination pattern in your schools. Class 12 students should practice questions and answers given here for Informatics Practices in Class 12 which will help them to improve your knowledge of all important chapters and its topics. Students should also download free pdf of Class 12 Informatics Practices Worksheets prepared by teachers as per the latest Informatics Practices books and syllabus issued this academic year and solve important problems with solutions on daily basis to get more score in school exams and tests
Worksheet for Class 12 Informatics Practices Chapter 2 Data Handling using Pandas
Class 12 Informatics Practices students should refer to the following printable worksheet in Pdf for Chapter 2 Data Handling using Pandas in Class 12. This test paper with questions and answers for Class 12 will be very useful for exams and help you to score good marks
Class 12 Informatics Practices Worksheet for Chapter 2 Data Handling using Pandas
QUESTION AND ANSWER SECTION
Question. What will be the output of following codeimport pandas as pd
s1=pd.Series([1,2,2,7,’Sachin’,77.5])
print(s1.head())
print(s1.head(3))
Answer:
0 1
1 2
2 2
3 7
4 Sachin
dtype: object
0 1
1 2
2 2
dtype: object
Question. Write a program to display only those values greater than 200 in the given Series “S1”
0 300
1 100
2 1200
3 1700
Answer:
import pandas as pd
S1 = pd.Series([300, 100, 1200, 1700])
print(S1[S1>200])
Question. In pandas, S is a series with the following result:
S=pd.Series([5,10,15,20,25])
The series object is automatically indexed as 0,1,2,3,4. Write a statement to
assign the series as a, b, c, d, e index explicitly.
Answer:
S=pd.Series([5,10,15,20,25],index=['a','b','c','d','e'])
Question. Name any two attributes of Series in Python
Answer: Two attributes of Series in Python are :
1. index
2. values
Question. Write the output of the following :
import numpy as num
import pandas as pd
arr=num.array([1,7,21])
S1 = pd.Series(arr)
print(S1)
Answer:
0 1
1 7
2 21
dtype: int32
Question. Which property of series return all the index value?
Answer: index property return all the index value
Question. Write the output of the following :
import pandas as pd
S1 = pd.Series(range(1,15,3), index=[x for x in "super"])
print(S1)
Answer:
s 1
u 4
p 7
e 10
r 13
dtype: int64
Question. Complete the code to get the required output :
import ______ as pd
________ = pd.Series([31, 28, 31], index = ["Jan", "Feb", "Mar"] )
print(S1["_______"])
OUTPUT :
28
Answer:
import pandas as pd
S1 = pd.Series([31,28,31], index = ["Jan","Feb","Mar"])
print(S1["Feb"])
Question. Write the output of the following code :
import pandas as pd
S1 = pd.Series([31, 28, 31, 30, 31], index = ["Jan", "Feb", "Mar", "Apr", "May"])
print("-----------")
print(S1[1:3])
print("-----------")
print(S1[:5])
print("-----------")
print(S1[3:3])
print("-----------")
print(S1["Jan":"May"])
Answer:
-----------
Feb 28
Mar 31
dtype: int64
-----------
Jan 31
Feb 28
Mar 31
Apr 30
May 31
dtype: int64
-----------
Series([ ], dtype: int64)
-----------
Jan 31
Feb 28
Mar 31
Apr 30
May 31
dtype: int64
DATA FRAMES
Question. What are the purpose of following statements-
1.df.columns
2. df.iloc[ : , :-5]
3. df[2:8]
4. df[ :]
5. df.iloc[ : -4 , : ]
Answer:
1. It displays the names of columns of the Dataframe.
2. It will display all columns except the last 5 columns.
3. It displays all columns with row index 2 to 7.
4. It will display entire dataframe with all rows and columns.
5. It will display all rows except the last 4 four rows
Question. What will be the output of df.iloc[3:7,3:6]?
Answer: It will display the rows with index 3 to 6 and columns with index 3 to 5 in a dataframe ‘df’.
Question. Write a python program to create a data frame with headings (CS and IP) from the list given below-
[[79,92][86,96],[85,91],[80,99]]
Answer:
l=[[10,20],[20,30],[30,40]]
df=pd.DataFrame(l,columns=['CS','IP'])
print(df)
Question. Write python statement to delete the 3rd and 5th rows from dataframe df.
Answer: df1=df.drop(index=[2,4],axis=0)
or
df1=df.drop([2,4])
MCQ QUESTIONS
Question. To display the 3rd, 4th and 5th columns from the 6th to 9th rows of a dataframe you can write
a. DF.loc[6:9, 3:5]
b. DF.loc[6:10, 3:6]
c. DF.iloc[6:10, 3:6]
d. DF.iloc[6:9, 3:5]
Answer: C
Question. We can add a new row to a DataFrame using the _____________ method
a. rloc[ ]
b. loc[ ]
c. iloc[ ]
d. None of the above
Answer: B
Question. The head() function of dataframe will display how may rows from top if no parameter is passed.
a. 1
b. 3
c. 5
d. None of these
Answer: C
Question. To change the 5th column's value at 3rd row as 35 in dataframe DF, you can write
a. DF[4, 6] = 35
b. DF.iat[4, 6] = 35
c. DF[3, 5] = 35
d. DF.iat[3, 5] = 35
Answer: D
Question. Which function is used to find values from a DataFrame D using the index number?
a. D.loc
b. D.iloc
c. D.index
d. None of these
Answer: B
Question. In a DataFrame, Axis= 0 represents the elements
a. rows
b.columns
c. both
d. None of these.
Answer: A
Question. In DataFrame, by default new column added as the _____________ column
a. First (Left Side)
b. Second
c.Last (Right Side)
d. Any where in dataframe
Answer: C
Question. Which of the following is correct Features of DataFrame?
a. Potentially columns are of different types
b. Can Perform Arithmetic operations on rows and columns
c. Labeled axes (rows and columns)
d. All of the above
Answer: D
Question. Write the code to append df2 with df1
a.Df2=Df2.append(Df1)
b. Df2=Df2+Df1
c. Df2=Df2.appendwith.Df1
d. Df2=Df1.append(Df1)
Answer: A
Question. When we create DataFrame from List of Dictionaries, then number of columns in DataFrame isequal to the _______
a. maximum number of keys in first dictionary of the list
b. maximum number of different keys in all dictionaries of the list
c. maximum number of dictionaries in the list
d. None of the above
Answer: B
Question. When we create DataFrame from List of Dictionaries, then dictionary keys will become ______
a. Column labels
b. Row labels
c. Both of the above
d. None of the above
Answer: A
Question. Which method is used to access vertical subset of a dataframe?
a. iterrows()
b. iteritems()
c. itercolumns()
d. itercols()
Answer: B
Question. Write statement to transpose dataframe DF.
a. DF.t
b. DF.transpose
c.DF.T
d.DF.T( )
Answer: C
Question. In DataFrame, by default new column added as the _____________ column
a. First (Left Side)
b. Second
c. Last (Right Side)
d. Any where in dataframe
Answer: C
Question. We can add a new row to a DataFrame using the _____________ method
a. rloc[ ]
b. loc[ ]
c. iloc[ ]
d. None of the above
Answer: B
Question. Which of the following function is used to load the data from the CSV file to DataFrame?
a. read.csv( )
b. readcsv( )
c. read_csv( )
d. Read_csv( )
Answer: C
Question. Which of the following function is not a Boolean reduction function
a. Empty
b. Any()
c. All()
d. Fillna()
Answer: D
Question. Which among the following options can be used to create a DataFrame in Pandas ?
a. A scalar value
b. An ndarray
c. A python dict
d. All of these
Answer: D
Question. Which attribute of a dataframe is used to convert row into columns and columns into rows in a dataframe?
a. T
b. ndim
c. empty
d. shape
Answer: A
Question. When we create DataFrame from List of Dictionaries, then number of columns in DataFrame is equal to the _______
a. maximum number of keys in first dictionary of the list
b. maximum number of different keys in all dictionaries of the list
c. maximum number of dictionaries in the list
d. None of the above
Answer: B
Question. Which of the following is/are characteristics of DataFrame?
a. Columns are of different types
b. Can Perform Arithmetic operations
c. Axes are labeled (rows and columns)
d. All of the above
Answer: D
Question. Write short code to show the information having city=”Delhi” from dataframe SHOP.
a. print(SHOP[City==’Delhi’])
b. print(SHOP[SHOP.City==’Delhi’])
c. print(SHOP[SHOP.’City’==’Delhi’])
d. print(SHOP[SHOP[City]==’Delhi’])
Answer: B
Question. Which of the following commands is used to install pandas?
a. pip install python –pandas
b. pip install pandas
c. python install python
d. python install pandas
Answer: B
Question. Assuming the given structure, which command will give us the given output:
Output Required: (3,4)
EmpCode Name Desig
0 1405 VINAY Clerk
1 1985 MANISH Works Manager
2 1636 SMINA Sales Manager
3 1689 RINU Cleark
a. print(df.shape())
b. print(df.shape)
c. print(df.size)
d. print(df.size()).
Answer: B
Question. Write the output of the given command: df1.loc[:0,'Name'] Consider the given dataframe.
EmpCode Name Desig
0 1405 VINAY Clerk
1 1985 MANISH Works Manager
2 1636 SMINA Sales Manager
3 1689 RINU Clerk
a. 0 1405 VINAY Clerk
b. VINAY
c. Works Manager
d. Clerk
Answer: B
Question. which one of these is not a valid line style in matplotlib
a. ‘-‘
b. ‘--‘
c. ‘-.’
d. ‘<’
Answer: D
Question. How can we make bar chart horizontal?
a. plt.bar()
b. plt.hbar()
c. plt.barh()
d. plt.rightbar()
Answer: C
Question. A histogram is used:
a. for continuous data
b. for grouped data
c. for time series data
d. to compare two sets of data
Answer: A
Question. Which function is used to show legend ?
a. display ( )
b. show( )
c. legend( )
d. legends( )
Answer: C
Question. The datapoints plotted on a graph are called _____________
a. Markers
b. Values
c. Ticks
d. Pointers
Answer: A
Question. To specify the style of line as dashed , which argument of plot() needs to be set ?
a. line
b. width
c. Style
d. linestyle
Answer: D
Question. Which of the following is not a valid plotting function in pyplot?
a. bar()
b. hist()
c. histh()
d. barh()
Answer: C
Question. To get top 5 rows of a dataframe, you may use
a. head( )
b. head(5)
c. top( )
d. top(5)
Answer: A
Question. The correct statement to read from a CSV file in a dataframeis :
a. .read_csv()
b. . read_csv( )()
c. = pandas.read()
d. = pandas.read_csv()
Answer: D
Question. To delete a column from a dataframe, you may use ______ statement.
a. remove()
b. del()
c. drop()
d. cancel()
Answer: C
Question. To get top 5 rows of a dataframe, you may use
a. head( )
b. head(5)
c. top( )
d. top(5)
Answer: A
Question. To iterate over horizontal subsets of dataframe,
a. iterate( )
b. iterrows( ) function may be used.
c. itercols( )
d. iteritems( )
Answer: B
Question. Write code to delete the row whose index value is A1 from dataframe df.
a. df=df.drop(‘A1’)
b. df=df.drop(index=‘A1’)
c. df=df.drop(‘A1,axis=index’)
d. df=df.del(‘A1’)
Answer: A
Question. A two-dimension labelled array that is an ordered collection of columns to store heterogeneous datatype is
a. Series
b. Numpy array
c. Dataframe
d. Panel
Answer: C
Importing/Exporting Data between CSV files and Data Frames Basics of CSV Files
Question. Read the statements given below and identify the right option to draw a histogram.
Statement A: To make a Histogram with Matplotlib, we can use the plt.hist() function.
Statement B: The bin parameter is compulsory to create histogram.
a. Statement A is correct
b. Statement B is correct
c. Statement A is correct, but Statement B is incorrect
d. d. Statement A is incorrect, but Statement B is correct
Answer: D
Question. Which graph should be used where each column represents a range of values, and the height of a column corresponds to how many values are in that range?
a. plot
b. line
c. bar
d. histogram
Answer: D
Question. To give a title to x-axis, which of the following method is used?
a. plt.xtitle(“title”)
b. plt.xlabel(“title”)
c. plt.xheader(“title”)
d. plt.xlabel.show(“title”)
Answer: A
Question. To change the width of bars in bar chart, which of the following argument with a float value is used?
a. thick
b. thickness
c. width
d. barwidth
Answer: C
Question. What is the purpose of legend?
a. A legend is an area describing the elements of the graph.
b. A legend is top area with information about graph
c. A legend is additional information of x and y labels
d. A legend is a mini box with bars data
Answer: A
CBSE Class 12 Informatics Practices Data Handling using Pandas Worksheet |
CBSE Class 12 Informatics Practices Societal Impacts Worksheet |
Worksheet for CBSE Informatics Practices Class 12 Chapter 2 Data Handling using Pandas
We hope students liked the above worksheet for Chapter 2 Data Handling using Pandas designed as per the latest syllabus for Class 12 Informatics Practices released by CBSE. Students of Class 12 should download in Pdf format and practice the questions and solutions given in the above worksheet for Class 12 Informatics Practices on a daily basis. All the latest worksheets with answers have been developed for Informatics Practices by referring to the most important and regularly asked topics that the students should learn and practice to get better scores in their class tests and examinations. Expert teachers of studiestoday have referred to the NCERT book for Class 12 Informatics Practices to develop the Informatics Practices Class 12 worksheet. After solving the questions given in the worksheet which have been developed as per the latest course books also refer to the NCERT solutions for Class 12 Informatics Practices designed by our teachers. We have also provided a lot of MCQ questions for Class 12 Informatics Practices in the worksheet so that you can solve questions relating to all topics given in each chapter.
You can download the CBSE Printable worksheets for Class 12 Informatics Practices Chapter 2 Data Handling using Pandas for latest session from StudiesToday.com
There is no charge for the Printable worksheets for Class 12 CBSE Informatics Practices Chapter 2 Data Handling using Pandas you can download everything free
Yes, studiestoday.com provides all latest NCERT Chapter 2 Data Handling using Pandas Class 12 Informatics Practices test sheets with answers based on the latest books for the current academic session
CBSE Class 12 Informatics Practices Chapter 2 Data Handling using Pandas worksheets cover all topics as per the latest syllabus for current academic year.
Regular practice with Class 12 Informatics Practices worksheets can help you understand all concepts better, you can identify weak areas, and improve your speed and accuracy.