w3resource

Pandas DataFrame: describe() function

DataFrame - describe() function

The describe() function is used to generate descriptive statistics that summarize the central tendency, dispersion and shape of a dataset’s distribution, excluding NaN values.

Syntax:

DataFrame.describe(self, percentiles=None, include=None, exclude=None)

Parameters:

Name Description Type/Default Value Required / Optional
percentiles The percentiles to include in the output. All should fall between 0 and 1. The default is [.25, .5, .75], which returns the 25th, 50th, and 75th percentiles. list-like of numbers Optional
include   A white list of data types to include in the result. Ignored for Series. Here are the options:
  • 'all' : All columns of the input will be included in the output.
  • A list-like of dtypes : Limits the results to the provided data types. To limit the result to numeric types submit numpy.number. To limit it instead to object columns submit the numpy.object data type. Strings can also be used in the style of select_dtypes (e.g. df.describe(include=['O'])). To select pandas categorical columns, use 'category'
  • None (default) : The result will include all numeric columns.
'all', list-like of dtypes or None (default) Optional
exclude   A black list of data types to omit from the result. Ignored for Series. Here are the options:
  • A list-like of dtypes : Excludes the provided data types from the result. To exclude numeric types submit numpy.number. To exclude object columns submit the data type numpy.object. Strings can also be used in the style of select_dtypes (e.g. df.describe(include=['O'])). To exclude pandas categorical columns, use 'category'
  • None (default) : The result will exclude nothing.
list-like of dtypes or None (default) Optional

Returns: Series or DataFrame
Summary statistics of the Series or Dataframe provided.

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - cumsum() function
Next: DataFrame - diff() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/pandas/dataframe/dataframe-describe.php