【发布时间】:2019-11-25 12:12:32
【问题描述】:
我在这个论坛中发现了一个代码,可以计算并在直方图上显示偏度和峰度。
这是我在情节中使用的代码:
sns.distplot(data['HR90'], color="blue", bins=15, kde=True)
ax.text(x=0.97, y=0.97, transform=ax.transAxes, s="Skewness: %f" % data.iloc[:,i].skew(),\
fontweight='demibold', fontsize=10, verticalalignment='top', horizontalalignment='right',\
backgroundcolor='white', color='xkcd:poo brown')
ax.text(x=0.97, y=0.91, transform=ax.transAxes, s="Kurtosis: %f" % data.iloc[:,i].kurt(),\
fontweight='demibold', fontsize=10, verticalalignment='top', horizontalalignment='right',\
backgroundcolor='white', color='xkcd:dried blood')
但我得到了一个错误:
ValueError: 基于位置的索引只能有 [integer, integer 切片(包含起点,排除终点),类似列表 整数、布尔数组] 类型
我知道这里的问题是位置,可能是代码中显示 iloc 的部分,但我不知道如何解决它,我刚刚开始使用 python,所以解释越广泛,我的问题就越少'会有...
我的最终目标是调整这些图上的峰度和偏度
【问题讨论】:
标签: python pandas histogram kurtosis