Generate Seaborn Countplot using column value as c

2019-07-29 09:30发布

问题:

For the following table

                             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

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))

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

回答1:

I think you need seaborn.barplot:

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