python绘制直方图和密度图的实例

yipeiwu_com7年前Python基础

对于pandas的dataframe,绘制直方图方法如下:

//pdf是pandas的dataframe, delta_time是其中一列
//xlim是x轴的范围,bins是分桶个数
pdf.delta_time.plot(kind='hist', xlim=(-50,300), bins=500)

对于pandas的dataframe,绘制概率密度图方法如下:

//pdf是pandas的dataframe, delta_time是其中一列

pdf.delta_time.dropna().plot(kind='kde', xlim=(-50,300))

以上这篇python绘制直方图和密度图的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

python client使用http post 到server端的代码

复制代码 代码如下:import urllib, httplib  import utils  import json     ...

通过cmd进入python的实例操作

通过cmd进入python的实例操作

通过cmd启动Python需要先设置系统环境,设置步骤如下: 1、首先,在桌面找到 “计算机” 右键 找到 “属性”或者按下 win 键 再右键“计算机” 找到 “属性”也可以。如下图所...

ansible作为python模块库使用的方法实例

前言 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量...

Python变量和数据类型详解

Python 变量类型       变量存储在内存中的值。这就意味着在创建变量时会在内存中开辟一个空间。   &nb...

python xml解析实例详解

python xml解析 first.xml  <info> <person > <id>1</id> <n...