我被困在这个投资分析火花基金代码。我已经按国家代码过滤掉了,我的数据只有3个国家。但是,当我针对它运行一个框图时,会显示整个国家列表。
#Filtering the top 03 Countries where maximum Investments have taken place
master_venture_new = master_venture[ (master_venture.country_code =='USA') | (master_venture.country_code =='GBR' ) | (master_venture.country_code =='IND')]
master_venture_new.head(3)
sns.boxplot(x='country_code', y = 'raised_amount_usd', data = master_venture_new)
plt.show()需要帮助才能理解如何解决这个问题。
发布于 2022-06-17 03:12:02
若要不包括筛选出的级别,则必须在筛选数据后将列转换为类别,否则在绘制图表之前,需要删除分类功能的未使用级别。
这样做的代码是:
master_venture_new.country_code.cat.remove_unused_categories(inplace=True)
https://stackoverflow.com/questions/70142904
复制相似问题