Data Science Questions and Answers – Time Deltas

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

Answer: a
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

Answer: a
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

Answer: c
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

Answer: d
Explanation: These operations yield Series and propagate NaT -> nan.

advertisement
advertisement

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

Answer: b
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

Answer: b
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

Answer: a
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

Answer: b
Explanation: Categorical data has a categories and a ordered property.

advertisement

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

Answer: a
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

Answer: a
Explanation: Categoricals are pandas data type.

advertisement

Sanfoundry Global Education & Learning Series – Data Science.

Here’s the list of Best Books in Data Science.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.