小编Sha*_*har的帖子

ValueError:<something>的Grouper不是1维的

我有以下代码,通过seaborn创建一个表和一个barplot.

#Building a dataframe grouped by the # of Engagement Types
sales_type = sales.groupby('# of Engagement Types').sum()

#Calculating the % of people who bought the course by # engagement types
sales_type['% Sales per Participants'] =  round(100*(sales_type['Sales'] / sales_type['Had an Engagement']), 2)

#Calculating the # of people who didn't have any engagements
sales_type.set_value(index=0, col='Had an Engagement', value=sales[sales['Had an Engagement']==0].count()['Sales'])

#Calculating the % of sales for those who didn't have any engagements
sales_type.set_value(index=0, col='% Sales per Participants',
                     value=round(100 * (sales_type.ix[0, 'Sales'] / …
Run Code Online (Sandbox Code Playgroud)

python pandas seaborn

25
推荐指数
4
解决办法
3万
查看次数

标签 统计

pandas ×1

python ×1

seaborn ×1