官术网_书友最值得收藏!

Computing descriptive statistics

In this section, we will review methods for obtaining descriptive statistics from data that is stored in a pandas DataFrame. We will use the pandas library to compute statistics from the data. So, let's jump right in!

DataFrames come equipped with many methods for computing common descriptive statistics for the data they contain. This is one of the advantages of storing data in DataFrames—working with data stored this way is easy. Getting common descriptive statistics, such as the mean, the median, the standard deviation, and more, is easy for data that is present in DataFrames. There are methods that can be called in order to quickly compute each of these. We will review several of these methods now.

If you want a basic set of descriptive statistics, just to get a sense of the contents of the DataFrame, consider using the describe() method. It includes the mean, standard deviation, an account of how much data there is, and the five-number summary built in.

Sometimes, the statistic that you want isn't a built-in DataFrame method. In this case, you will write a function that works for a pandas series, and then apply that function to each column using the apply() method.

主站蜘蛛池模板: 务川| 桐城市| 肇源县| 盐亭县| 普洱| 九龙坡区| 马山县| 江北区| 北海市| 信丰县| 赤城县| 山西省| 昌图县| 灵台县| 鄂温| 商水县| 昭苏县| 淮安市| 绥江县| 罗甸县| 威信县| 沧州市| 阳谷县| 吴旗县| 许昌市| 黑龙江省| 金华市| 广宗县| 贵溪市| 东乌珠穆沁旗| 阜南县| 三原县| 靖西县| 宁晋县| 界首市| 宁强县| 南皮县| 霍州市| 信阳市| 永清县| 大安市|