pandas.DataFrame.describe — pandas 0.20.2 documentation (2024)

Generates descriptive statistics that summarize the central tendency,dispersion and shape of a dataset’s distribution, excludingNaN values.

Analyzes both numeric and object series, as wellas DataFrame column sets of mixed data types. The outputwill vary depending on what is provided. Refer to the notesbelow for more detail.

Parameters:

percentiles : list-like of numbers, optional

The percentiles to include in the output. All shouldfall between 0 and 1. The default is[.25, .5, .75], which returns the 25th, 50th, and75th percentiles.

include : ‘all’, list-like of dtypes or None (default), optional

A white list of data types to include in the result. Ignoredfor 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 theprovided data types.To limit the result to numeric types submitnumpy.number. To limit it instead to categoricalobjects submit the numpy.object data type. Stringscan also be used in the style ofselect_dtypes (e.g. df.describe(include=['O']))
  • None (default) : The result will include all numeric columns.

exclude : list-like of dtypes or None (default), optional,

A black list of data types to omit from the result. Ignoredfor Series. Here are the options:

  • A list-like of dtypes : Excludes the provided data typesfrom the result. To select numeric types submitnumpy.number. To select categorical objects submit the datatype numpy.object. Strings can also be used in the style ofselect_dtypes (e.g. df.describe(include=['O']))
  • None (default) : The result will exclude nothing.
Returns:

summary: Series/DataFrame of summary statistics

See also

DataFrame.count, DataFrame.max, DataFrame.min, DataFrame.mean, DataFrame.std, DataFrame.select_dtypes

Notes

For numeric data, the result’s index will include count,mean, std, min, max as well as lower, 50 andupper percentiles. By default the lower percentile is 25 and theupper percentile is 75. The 50 percentile is thesame as the median.

For object data (e.g. strings or timestamps), the result’s indexwill include count, unique, top, and freq. The topis the most common value. The freq is the most common value’sfrequency. Timestamps also include the first and last items.

If multiple object values have the highest count, then thecount and top results will be arbitrarily chosen fromamong those with the highest count.

For mixed data types provided via a DataFrame, the default is toreturn only an analysis of numeric columns. If include='all'is provided as an option, the result will include a union ofattributes of each type.

The include and exclude parameters can be used to limitwhich columns in a DataFrame are analyzed for the output.The parameters are ignored when analyzing a Series.

Examples

Describing a numeric Series.

>>> s = pd.Series([1, 2, 3])>>> s.describe()count 3.0mean 2.0std 1.0min 1.025% 1.550% 2.075% 2.5max 3.0

Describing a categorical Series.

>>> s = pd.Series(['a', 'a', 'b', 'c'])>>> s.describe()count 4unique 3top afreq 2dtype: object

Describing a timestamp Series.

>>> s = pd.Series([...  np.datetime64("2000-01-01"),...  np.datetime64("2010-01-01"),...  np.datetime64("2010-01-01")... ])>>> s.describe()count 3unique 2top 2010-01-01 00:00:00freq 2first 2000-01-01 00:00:00last 2010-01-01 00:00:00dtype: object

Describing a DataFrame. By default only numeric fieldsare returned.

>>> df = pd.DataFrame([[1, 'a'], [2, 'b'], [3, 'c']],...  columns=['numeric', 'object'])>>> df.describe() numericcount 3.0mean 2.0std 1.0min 1.025% 1.550% 2.075% 2.5max 3.0

Describing all columns of a DataFrame regardless of data type.

>>> df.describe(include='all') numeric objectcount 3.0 3unique NaN 3top NaN bfreq NaN 1mean 2.0 NaNstd 1.0 NaNmin 1.0 NaN25% 1.5 NaN50% 2.0 NaN75% 2.5 NaNmax 3.0 NaN

Describing a column from a DataFrame by accessing it asan attribute.

>>> df.numeric.describe()count 3.0mean 2.0std 1.0min 1.025% 1.550% 2.075% 2.5max 3.0Name: numeric, dtype: float64

Including only numeric columns in a DataFrame description.

>>> df.describe(include=[np.number]) numericcount 3.0mean 2.0std 1.0min 1.025% 1.550% 2.075% 2.5max 3.0

Including only string columns in a DataFrame description.

>>> df.describe(include=[np.object]) objectcount 3unique 3top bfreq 1

Excluding numeric columns from a DataFrame description.

>>> df.describe(exclude=[np.number]) objectcount 3unique 3top bfreq 1

Excluding object columns from a DataFrame description.

>>> df.describe(exclude=[np.object]) numericcount 3.0mean 2.0std 1.0min 1.025% 1.550% 2.075% 2.5max 3.0
pandas.DataFrame.describe — pandas 0.20.2 documentation (2024)
Top Articles
Main Switches, On-Load-Switches, Cam Switches On-Off | B-COMMAND
Find Quality Yeast Near You - Lesaffre UK & Ireland
Compare Foods Wilson Nc
Uihc Family Medicine
Goodbye Horses: The Many Lives of Q Lazzarus
Manhattan Prep Lsat Forum
Victoria Secret Comenity Easy Pay
Natureza e Qualidade de Produtos - Gestão da Qualidade
Lantana Blocc Compton Crips
5808 W 110Th St Overland Park Ks 66211 Directions
Inevitable Claymore Wow
A Guide to Common New England Home Styles
10-Day Weather Forecast for Florence, AL - The Weather Channel | weather.com
Carolina Aguilar Facebook
The Ultimate Style Guide To Casual Dress Code For Women
Praew Phat
Farmer's Almanac 2 Month Free Forecast
Osborn-Checkliste: Ideen finden mit System
Is A Daytona Faster Than A Scat Pack
Selfservice Bright Lending
Sodium azide 1% in aqueous solution
Gran Turismo Showtimes Near Marcus Renaissance Cinema
Jobs Hiring Near Me Part Time For 15 Year Olds
8000 Cranberry Springs Drive Suite 2M600
Www.craigslist.com Austin Tx
Deshuesadero El Pulpo
Craigslist Wilkes Barre Pa Pets
Mineral Wells Skyward
Strange World Showtimes Near Savoy 16
Hesburgh Library Catalog
Kroger Feed Login
2004 Honda Odyssey Firing Order
Shia Prayer Times Houston
Meowiarty Puzzle
The Vélodrome d'Hiver (Vél d'Hiv) Roundup
7543460065
Qlima© Petroleumofen Elektronischer Laserofen SRE 9046 TC mit 4,7 KW CO2 Wächter • EUR 425,95
18 terrible things that happened on Friday the 13th
Pro-Ject’s T2 Super Phono Turntable Is a Super Performer, and It’s a Super Bargain Too
About My Father Showtimes Near Amc Rockford 16
Barstool Sports Gif
Doe Infohub
Sarahbustani Boobs
Citroen | Skąd pobrać program do lexia diagbox?
Conan Exiles Tiger Cub Best Food
N33.Ultipro
Oakley Rae (Social Media Star) – Bio, Net Worth, Career, Age, Height, And More
Makemkv Key April 2023
Assignation en paiement ou injonction de payer ?
What your eye doctor knows about your health
Taterz Salad
Latest Posts
Article information

Author: Trent Wehner

Last Updated:

Views: 5654

Rating: 4.6 / 5 (56 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Trent Wehner

Birthday: 1993-03-14

Address: 872 Kevin Squares, New Codyville, AK 01785-0416

Phone: +18698800304764

Job: Senior Farming Developer

Hobby: Paintball, Calligraphy, Hunting, Flying disc, Lapidary, Rafting, Inline skating

Introduction: My name is Trent Wehner, I am a talented, brainy, zealous, light, funny, gleaming, attractive person who loves writing and wants to share my knowledge and understanding with you.