Pandas Data Structure

Question 1
Marks : +2 | -2
Pass Ratio : 50%
If data is an ndarray, index must be the same length as data.
True
False
Explanation:
If no index is passed, one will be created having values [0, …, len(data) – 1].
Question 2
Marks : +2 | -2
Pass Ratio : 50%
Point out the correct statement.
If data is a list, if index is passed the values in data corresponding to the labels in the index will be pulled out
NaN is the standard missing data marker used in pandas
Series acts very similarly to a array
None of the mentioned
Explanation:
If data is a dict, if index is passed the values in data corresponding to the labels in the index will be pulled out.
Question 3
Marks : +2 | -2
Pass Ratio : 50%
Which of the following thing can be data in Pandas?
a python dict
an ndarray
a scalar value
all of the mentioned
Explanation:
The passed index is a list of axis labels.
Question 4
Marks : +2 | -2
Pass Ratio : 50%
Which of the following input can be accepted by DataFrame?
Structured ndarray
Series
DataFrame
All of the mentioned
Explanation:
DataFrame is a 2-dimensional labeled data structure with columns of potentially different types.
Question 5
Marks : +2 | -2
Pass Ratio : 50%
Point out the wrong statement.
A DataFrame is like a fixed-size dict in that you can get and set values by index label
Series can be be passed into most NumPy methods expecting an ndarray
A key difference between Series and ndarray is that operations between Series automatically align the data based on label
None of the mentioned
Explanation:
A Series is like a fixed-size dict in that you can get and set values by index label.
Question 6
Marks : +2 | -2
Pass Ratio : 100%
Which of the following works analogously to the form of the dict constructor?
DataFrame.from_items
DataFrame.from_records
DataFrame.from_dict
All of the mentioned
Explanation:
DataFrame.from_records takes a list of tuples or an ndarray with structured dtype.
Question 7
Marks : +2 | -2
Pass Ratio : 50%
Which of the following operation works with the same syntax as the analogous dict operations?
Getting columns
Setting columns
Deleting columns
All of the mentioned
Explanation:
You can treat a DataFrame semantically like a dict of like-indexed Series objects.
Question 8
Marks : +2 | -2
Pass Ratio : 50%
Which of the following takes a dict of dicts or a dict of array-like sequences and returns a DataFrame?
DataFrame.from_items
DataFrame.from_records
DataFrame.from_dict
All of the mentioned
Explanation:
DataFrame.from_dict operates like the DataFrame constructor except for the orient parameter which is ‘columns’ by default.
Question 9
Marks : +2 | -2
Pass Ratio : 50%
Series is a one-dimensional labeled array capable of holding any data type.
True
False
Explanation:
The axis labels are collectively referred to as the index.
Question 10
Marks : +2 | -2
Pass Ratio : 50%
The result of an operation between unaligned Series will have the ________ of the indexes involved.
intersection
union
total
all of the mentioned
Explanation:
If a label is not found in one Series or the other, the result will be marked as missing NaN.