使用列值作为计数来生成Seaborn Countplot [英] Generate Seaborn Countplot using column value as count

查看:183
本文介绍了使用列值作为计数来生成Seaborn Countplot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于下表

                             count_value
CPUCore Offline_RetentionAge       
i7      183                    4184
        7                      1981
        30                      471
i5      183                    2327
        7                       831
        30                      250
Pentium 183                     333
        7                       125
        30                       43
2       183                     575
        7                       236
        31                       96

是否可以生成如下的海洋计数图(或正常计数图)(使用sns.countplot(x='CPUCore', hue="Offline_BackupSchemaIncrementType", data=dfCombined_df)生成)

Is it possible to generate a seaborn countplot (or normal countplot) like the following (generated using sns.countplot(x='CPUCore', hue="Offline_BackupSchemaIncrementType", data=dfCombined_df))

这里的问题是我需要使用count_value作为计数,而不是真正去计算Offline_RetentionAge

Problem here is that I need to use the count_value as count, rather then really go and count the Offline_RetentionAge

推荐答案

我认为您需要 seaborn.barplot :

sns.barplot(x="count_value", y="index", hue='Offline_RetentionAge', data=df.reset_index())

这篇关于使用列值作为计数来生成Seaborn Countplot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆