Which of the following function will display the descriptive statistical values in a single command?
Which of the following function will display the descriptive statistical values in a single command?
Solution
describe() is a method of a pandas DataFrame (and Series), so it is called with a dot and parentheses as DataFrame.describe(). In one command it returns the count, mean, standard deviation, minimum, 25%, 50% (median), 75% and maximum for each numeric column.
Option 1: methods are called with round brackets, and square brackets are used for indexing, so this gives an error.
Option 2: describe() is not a top-level pandas function. It must be called on a DataFrame or Series object.
Option 3: the underscore makes DataFrame_describe a single undefined name, not a method call on the DataFrame.
Related questions:
2025: 20 May Shift 1
2025: 16 May Shift 1