Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

in data analysis, we often need to calculate the frequency of each cate…

Question

in data analysis, we often need to calculate the frequency of each category in a vector or series. if youre using python, you would write: import pandas as pd pd.series(apple, banana, apple, orange).value_counts() if youre using r, you would write: table(c(apple, banana, apple, orange)) which of the following correctly identifies the functions used in each language? a. table() (in r); value_counts() (in python) b. sum() (in r); sum() (in python) c. totals() (in r); totals() (in python) d. categories() (in r); categories() (in python)

Explanation:

Brief Explanations

In the provided Python code, value_counts() is used to calculate the frequency of each category in a Series. In the R - code, table() is used for the same purpose of counting the occurrences of each category in a vector.

Answer:

A. table() (in R); value_counts() (in Python)