This set of Data Science Multiple Choice Questions & Answers (MCQs) focuses on “Time Deltas”.
1. Which of the following operations are supported on Time Frames?
a) idxmax
b) ixmax
c) ixmin
d) none of the mentioned
View Answer
Explanation: Operands can also appear in a reversed order.
2. Point out the correct statement.
a) Timedeltas are differences in times, expressed in difference units
b) You can construct a Timedelta scalar through various argument
c) DateOffsets cannot be used in construction
d) All of the mentioned
View Answer
Explanation: Timedeltas can be both positive and negative.
3. Numeric reduction operation for timedelta64[ns] will return _________ objects.
a) Timeseries
b) Timeplus
c) Timedelta
d) None of the mentioned
View Answer
Explanation: NaT are skipped during evaluation.
4. Which of the following scalars can be converted to other ‘frequencies’ by as typing to a specific timedelta type?
a) Timedelta Series
b) TimedeltaIndex
c) Timedelta
d) All of the mentioned
View Answer
Explanation: These operations yield Series and propagate NaT -> nan.
5. Point out the wrong statement.
a) min, max, idxmin, idxmax operations are supported on Series
b) You cannot pass a timedelta to get a particular value
c) Division by the numpy scalar is true division
d) None of the mentioned
View Answer
Explanation: Dividing or multiplying a timedelta64[ns] Series by an integer or integer Series yields another timedelta64[ns] dtypes Series.
6. Which of the following is used to generate an index with time delta?
a) TimeIndex
b) TimedeltaIndex
c) LeadIndex
d) None of the mentioned
View Answer
Explanation: Using TimedeltaIndex you can pass string-like, Timedelta, timedelta, or np.timedelta64 objects.
7. Combination of TimedeltaIndex with DatetimeIndex allow certain combination operations that are NaT preserving.
a) True
b) False
View Answer
Explanation: You can also convert indices to yield another index.
8. Using _________ on categorical data will produce similar output to a Series or DataFrame of type string.
a) .desc()
b) .describe()
c) .rank()
d) none of the mentioned
View Answer
Explanation: Categorical data has a categories and a ordered property.
9. Which of the following method can be used to rename categorical data?
a) Categorical.rename_categories()
b) Categorical.rename()
c) Categorical.mv_categories()
d) None of the mentioned
View Answer
Explanation: Renaming categories is done by assigning new values to the Series.cat.categories property.
10. All values of categorical data are either in categories or np.nan.
a) True
b) False
View Answer
Explanation: Categoricals are pandas data type.
Sanfoundry Global Education & Learning Series – Data Science.
Here’s the list of Best Books in Data Science.
- Check Computer Science Books
- Apply for Data Science Internship
- Check Data Science Books
- Apply for Computer Science Internship
- Practice Computer Science MCQs