我有一列值,我必须像<;0.99,1至1.99,2至3.99和4>;
我尝试了下面的代码
data = pd.cut(TPA_Data_Details['cokumn name'], bins=[-np.inf,0.99,1,1.99,2,3.99,4,np.inf])
plt.figure(figsize=(17,15))
sns.countplot(data)
但是它给出的输出是这样的
如何从(-inf,0.99),(1,1.99),(2,3.99)和(4,inf)生成条形图
Tags:
如果确实要排除部分范围,则必须自己组织直方图:
样本输出:
最后一个bin实际上包含
np.inf
,但您将设法将x标签更改为[4.0, inf]
相关问题 更多 >
编程相关推荐