Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

pandas
python
dataframe
communitycreator

What is describe() in pandas?

Eman Kashif

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Pandas is an open-source Python library that is used in data analysis. It provides functionalities to manipulate data in the form of table structures called data frames. The describe() method displays a statistical summary of the data that consists of the mean, the standard deviation, the minimum and maximum value, and so on.

Syntax

dataFrame.describe(percentiles, include, exclude, datetime_is_numeric)

Arguments

  1. percentiles: Values between 0 and 1. Specifies the percentile to be returned in the result. (Optional)
  2. include: List of data types to include in the result. Options are None | ‘all’ | datatypes. (Optional)
  3. exclude: List of data types to exclude in the result. Options are None | ‘all’ | datatypes. (Optional)
  4. datetime_is_numeric: To treat datetime data as numeric. Set to True or False, with default as False. (Optional)

Return Value

The functions return a DataFrame object, where each row has a type of statistic that provides a summary of the columns.

Example code

#import library
import pandas as pd

#define data
data =  {'Name': ['Kris', 'Kelly', 'Josh', 'Bob','Lisa'],
          'Age': [16, 21, 17, 19, 20],
        'Marks': [78, 56, 87, 89, 79]}

#create a DataFrame object
df = pd.DataFrame(data)

#describe the data
print(df.describe())

RELATED TAGS

pandas
python
dataframe
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring