hist()函数被定义为了解数据集中某些数字变量分布的一种快速方法。它将数字变量中的值划分为" bins "。它计算落入每个箱柜中的检查次数。这些集合负责通过可视化集合来快速直观地了解变量中值的分布。
无涯教程可以使用 DataFrame.hist()方法创建直方图,该方法是matplotlib pyplot API的包装器。
DataFrame.hist(data, column=None, by=None, grid=True, xlabelsize=None, xrot=None, ylabelsize=None, yrot=None, ax=None, sharex=False, sharey=False, figsize=None, layout=None, bins=10, **kwds)
它返回matplotlib.AxesSubplot或numpy.ndarray。
import pandas as pd info = pd.DataFrame({ 'length': [2, 1.7, 3.6, 2.4, 1], 'width': [4.2, 2.6, 1.6, 5.1, 2.9] }) hist = info.hist(bins=4)
输出
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Spring Cloud 微服务项目实战 -〔姚秋辰(姚半仙)〕