INFORMATICS PRACTICES
PYTHON PANDAS - I (2021-22)
OBJECTIVE QUESTIONS
===============================================
1.
To create an empty Series object, you can use:
(a) pd. Series(empty)
(b) Pd.Series(np.NaN)
(c) pd.Series(
)
(d) All of these
2. To check if the Series object contains NaN
values______ attribute is displayed.
(a) hasnans
(b) nbytes
(c) ndim
(d) dtype
3. To get the number of bytes of the Series data,
_____ attribute is displayed.
(a) hasnans
(b) nbytes
(c) ndim
(d) dtype
4. To get the number of elements in a Series
object, _____ attribute may be used.
(a) index
(b) size
(c) itemsize
(d) ndim
5. To get the size of datatype of the items in
Series object, you can display _____ attribute.
(a) Index
(b) size
(c) Itemsize
(d) ndim
6. To get the number of dimensions of a Series
object, ______ attribute is displayed.
(a) index
(b) size
(c) itemsize
(d) ndim
7. To specify datatype int16 for a Series object,
you can write:
(a) pd.Series(data = array, dtype = int16)
(b) pd.Series(data = array, dtype = numpy.int16)
(c) pd.Series(data = array.dtype = pandas.int16)
(d) All of the above
8. To display third element of a Series object S,
you will write _____.
(a) S[ : 3]
(b) S[2]
(c) S[3]
(d) s[ :2]
9. To display first three elements of a Series
object S, you may write ______.
(a) S[:3]
(b) S[3]
(c) S[3rd]
(d) All of these
10. To display the last five rows of a Series
object S, you may wirte _______.
(a) head ()
(b) head(5)
(c) tail()
(d) tail(5)
11. Missing data in Pandas object is represented
through:
(a) Null
(b) None
(c) Missing
(d) NaN
12. If a DataFrame is created using 2D
dictionary, then the indexes/row labels are formed from _________.
(a) dictionary’s values
(b) inner dictionary’s keys
(c) outer dictionary’s keys
(d) None of these
13. If DataFrame is created using a 2D
dictionary, the coloumn labels are formed from _______.
(a) dictionary’s values
(b) inner dictionary’s keys
(c) outer dictionary’s keys
(d) None of these
14. The axis 0 identifies a dataframe’s ________.
(a) rows
(b) columns
(c) values
(d) datatypes
15. The axis 1 identifies a datafrme’s ________.
(a) rows
(b) columns
(c) values
(d) datatypes
16. To get
the number of elements in a dataframe, _____ attribute may be used.
(a) size
(b) shape
(c) values
(d) ndim
17. To get NumPy representation of a dataframe,
________ attribute may be used.
(a) size
(b) shape
(c) values
(d) ndim
18. To get a number representing number of axes
in a dataframe, ______ attribute may be used.
(a) size
(b) shape
(c) values
(d) ndim
19. To get the transpose of a datafrme D1, you
can write_______.
(a) D1.T
(b) D1.Transose
(c) D1.Swap
(d) All of these
20. To extract row/column from a dataframe,
_______ function may be used.
(a) row()
(b) column()
(c) loc()
(d) All of these
21. To display the 3rd, 4th
and 5th columns from the 6th to 9th rows of a
dataframe DF, 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]
22. To change the 5th column’s value
at 3rd row as 40 in dataframe
DF, you can write_______.
(a) DF[4,6] = 40
(b) DF[3,5] = 40
(c) DF.iat[4,6] = 40
(d) DF.iat=[3,5] = 40
23. Which among the following options cab be used
to create a DataFrame in Pandas?
(a) A scalar value
(b) An ndarray
(c) A python dict.
(d) All of these
24. Identify the correct statement:
(a) The standard marker for missing data in Pandas
is NaN.
(b) Series act in a way similar to that of an
array.
(c) Both (a) and (b)
(d) None of these
25. To delete a column from a DataFrame, you may
use _______ statement.
(a) remove
(b) del
(c) drop
(d) cancel
26. To delete a row from a DataFrame, you may use
_____ statement.
(a) remove
(b) del
(c) cancel
(d) drop
==========================
NOTE: Go to the Blog Archive and search Month Wise Contents
==========================
THANK YOU !!!
No comments:
Post a Comment
Please do not any spam in the comment box.