|

楼主 |
发表于 2021-1-25 18:46:07
|
显示全部楼层
还有一个问题就是在数据框中,describe打印的是有数值的列,但是当所有的列都含有非数值时,打印的是不是就是含有非数值最少的那列呢?
如下例子:- Step 14. Summarize the DataFrame.
- In [51]:
- users.describe() #Notice: by default, only the numeric columns are returned.
- Out[51]:
- age
- count 943.000000
- mean 34.051962
- std 12.192740
- min 7.000000
- 25% 25.000000
- 50% 31.000000
- 75% 43.000000
- max 73.000000
- Step 15. Summarize all the columns
- In [52]:
- users.describe(include = "all") #Notice: By default, only the numeric columns are returned.
- Out[52]:
- age gender occupation zip_code
- count 943.000000 943 943 943
- unique NaN 2 21 795
- top NaN M student 55414
- freq NaN 670 196 9
- mean 34.051962 NaN NaN NaN
- std 12.192740 NaN NaN NaN
- min 7.000000 NaN NaN NaN
- 25% 25.000000 NaN NaN NaN
- 50% 31.000000 NaN NaN NaN
- 75% 43.000000 NaN NaN NaN
- max 73.000000 NaN NaN NaN
复制代码 |
|