简体   繁体   中英

How to add attribute to describe() in pandas?

df.describe().loc[['mean','std','25%','50%','75%']]

如何向 describe() 函数的默认输出属性添加其他属性,例如百分位 10% 和 90%?

Use parameter percentiles in DataFrame.describe :

percentiles : list-like of numbers, optional
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.

df.describe(percentiles=[.1, .25, .5, .75, .9])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM