Python DataFrame.describe() Syntax

Syntax: df[‘cname’].describe(percentiles = None, include = None, exclude = None)
df.describe(percentiles = None, include = None, exclude = None)

Parameters:

  • percentiles: represents percentile value that has to be returned by the function. Default values are 0.25, 0.5 and 0.75
  • include: represents list of data types that has to be included
  • exclude: represents list of data types that has to be excluded

Creating a Sample DataFrame

Here, we are making a sample Pandas DataFrame that we will use in the whole article to show descriptive statistics in Pandas and it’s calculation.

Python3




# Import package
from pandas import DataFrame
 
# Create DataFrame
cart = {'Product': ['Mobile', 'AC', 'Mobile', 'Sofa', 'Laptop'],
        'Price': [20000, 28000, 22000, 19000, 45000],
        'Year': [2014, 2015, 2016, 2017, 2018]
        }
df = DataFrame(cart, columns = ['Product', 'Price', 'Year'])
 
# Original DataFrame
print("Original DataFrame:\n", df)


Output:

Original DataFrame:
Product Price Year
0 Mobile 20000 2014
1 AC 28000 2015
2 Mobile 22000 2016
3 Sofa 19000 2017
4 Laptop 45000 2018

How to Get the Descriptive Statistics for Pandas DataFrame?

describe() method in Python Pandas is used to compute descriptive statistical data like count, unique values, mean, standard deviation, minimum and maximum value, and many more. In this article, let’s learn to get the descriptive statistics for Pandas DataFrame.

Similar Reads

Python DataFrame.describe() Syntax

Syntax: df[‘cname’].describe(percentiles = None, include = None, exclude = None) df.describe(percentiles = None, include = None, exclude = None) Parameters: percentiles: represents percentile value that has to be returned by the function. Default values are 0.25, 0.5 and 0.75 include: represents list of data types that has to be included exclude: represents list of data types that has to be excluded...

Get the Descriptive Statistics for Pandas DataFrame

...

Contact Us