Python 在pandas和plotly中使用groupby函数绘制饼图

Python 在pandas和plotly中使用groupby函数绘制饼图,python,pandas,pandas-groupby,pie-chart,Python,Pandas,Pandas Groupby,Pie Chart,我正试图根据dataframe上的函数groupby绘制一个饼图 我能够返回groupby函数的正确结果,但是当我尝试绘制饼图时,它不会显示所有结果 代码: groupby函数的结果: number_person event_mohafaza event_type loc1 swimming 9157 foot

我正试图根据dataframe上的函数groupby绘制一个饼图

我能够返回groupby函数的正确结果,但是当我尝试绘制饼图时,它不会显示所有结果

代码: groupby函数的结果:

                                 number_person
event_mohafaza event_type                     
loc1           swimming                9157
               football                690
               baseball                2292

loc2           swimming               10560
               football               8987
               baseball               70280
              
loc3           basketball             130
               swimming               19395
               football               5370
               baseball               19078
              
loc4           swimming               9492
               football               50
               baseball               5279

loc5           swimming               4652
               football               2215
               baseball               3000
绘制的饼图:

它不显示它必须将饼图分成16个部分的所有值,现在它被分成8个部分

尝试使用:

values=ct['number\u person'].value\u counts()

请提供您的数据或一些示例数据好吗?
                                 number_person
event_mohafaza event_type                     
loc1           swimming                9157
               football                690
               baseball                2292

loc2           swimming               10560
               football               8987
               baseball               70280
              
loc3           basketball             130
               swimming               19395
               football               5370
               baseball               19078
              
loc4           swimming               9492
               football               50
               baseball               5279

loc5           swimming               4652
               football               2215
               baseball               3000