QUESTION IMAGE
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)
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.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
A. table() (in R); value_counts() (in Python)