Data Science Questions and Answers – Computational tools

This set of Data Science Multiple Choice Questions & Answers (MCQs) focuses on “Computational tools”.

1. Which of the following is used to compute the percent change over a given number of periods?
a) pct_change
b) percent_change
c) per_change
d) none of the mentioned
View Answer

Answer: a
Explanation: Series, DataFrame, and Panel all have a method pct_change.

2. Point out the correct statement.
a) Pandas represents timestamps in microsecond resolution
b) Pandas is 100% thread safe
c) For Series and DataFrame objects, var normalizes by N-1 to produce unbiased estimates
d) All of the mentioned
View Answer

Answer: c
Explanation: Pandas represents timestamps in nanosecond resolution.

3. Which of the following object has a method cov to compute covariance between series?
a) Series
b) DataFrame
c) Panel
d) None of the mentioned
View Answer

Answer: a
Explanation: DataFrame has a method cov to compute pairwise covariances among the series in the DataFrame, also excluding NA/null values.

4. Which of the following specifies the required minimum number of observations for each column pair in order to have a valid result?
a) min_periods
b) max_periods
c) minimum_periods
d) all of the mentioned
View Answer

Answer: a
Explanation: DataFrame.cov also supports an optional min_periods.

advertisement
advertisement

5. Point out the wrong statement.
a) lxml is very fast
b) lxml requires Cython to install correctly
c) lxml does not make any guarantees about the results of it’s parse
d) none of the mentioned
View Answer

Answer: c
Explanation: There are some versioning issues surrounding the libraries that are used to parse HTML tables in the top-level pandas io function read_html.

6. Which of the following is implemented on DataFrame to compute the correlation between like-labeled Series contained in different DataFrame objects?
a) corrwith
b) corwith
c) corwit
d) none of the mentioned
View Answer

Answer: a
Explanation: A score close to 1 means their tastes are very similar.

7. rolling_count function gives the number of non-null observations.
a) True
b) False
View Answer

Answer: b
Explanation: The binary operators take two Series or DataFrames.

8. Which of the following method produces a data ranking with ties being assigned the mean of the ranks for the group?
a) rank
b) dense_rank
c) partition_rank
d) none of the mentioned
View Answer

Answer: a
Explanation: rank is also a DataFrame method.

advertisement

9. Which of the following can potentially change the dtype of a series?
a) reindex_like
b) index_like
c) itime_like
d) none of the mentioned
View Answer

Answer: a
Explanation: reindex_like silently inserts NaNs and the dtype changes accordingly.

10. cov and corr supports the optional min_periods keyword.
a) True
b) False
View Answer

Answer: a
Explanation: Non-numeric columns will be automatically excluded from the correlation calculation.

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.