Using . . . . . . . . on categorical data will produce similar output to a Series or DataFrame of type string.

.desc()
.describe()
.rank()
none of the mentioned

The correct answer is: B. .describe()

The .describe() method returns a Series with the following columns:

  • count: The number of non-null values in the Series.
  • mean: The arithmetic mean of the values in the Series.
  • std: The standard deviation of the values in the Series.
  • min: The minimum value in the Series.
  • max: The maximum value in the Series.
  • 25%: The 25th percentile of the values in the Series.
  • 50%: The 50th percentile of the values in the Series, also known as the median.
  • 75%: The 75th percentile of the values in the Series.
  • kurtosis: The kurtosis of the values in the Series.
  • skewness: The skewness of the values in the Series.

For categorical data, the .describe() method will return a Series with the following columns:

  • count: The number of unique values in the Series.
  • unique: A list of the unique values in the Series.
  • top: The top 5 most common values in the Series.
  • freq: The frequency of each unique value in the Series.

The .rank() method returns a Series with the ranks of the values in the Series. The ranks are assigned in ascending order, with the lowest value being ranked 1 and the highest value being ranked n, where n is the number of values in the Series.

The .desc() method returns a Series with the values in the Series in descending order.

Therefore, the .describe() method is the only method that will produce similar output to a Series or DataFrame of type string for categorical data.

Exit mobile version