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

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.

主站蜘蛛池模板: 太原市| 封丘县| 绵竹市| 太白县| 民丰县| 洛宁县| 渑池县| 清水河县| 三江| 陆河县| 太仆寺旗| 开封县| 安图县| 武平县| 商河县| 孟津县| 韶关市| 余庆县| 平罗县| 晋城| 浦县| 红安县| 东平县| 道真| 广东省| 清苑县| 易门县| 正蓝旗| 泸西县| 和静县| 临高县| 元朗区| 五华县| 绥江县| 乌兰县| 麦盖提县| 鄯善县| 丘北县| 定结县| 南澳县| 台州市|