【发布时间】:2021-08-25 06:53:24
【问题描述】:
maleWomanSurvey = survey[(survey.Gender == 'Man') | (survey.Gender == 'Woman')]
maleWomanSurvey[maleWomanSurvey.Occupation == 'Currently not employed'].groupby('Gender').size()*100/maleWomanSurvey.groupby('Gender').size()
我想在我的数据中找到当前未就业的男性和女性的百分比。我怎样才能更轻松地做到这一点?当我使用 group by 两次时,我觉得我在做代码重复。
【问题讨论】:
标签: python pandas dataframe percentage