Question: Python Pandas Library How do I write the yellow highlighted code in order to sort it into only male and female and eliminate no gender

Python Pandas Library

How do I write the yellow highlighted code in order to sort it into only male and female and eliminate "no gender"

Python Pandas Library How do I write the yellow highlighted code in

In [60]: M \#5 print the names of male and female employees with highest and lowest salaries. In [78]: group =df. groupby ([ g Gender ]) In [79]: M highest_salary = group.apply (lambda x: x.nlargest (1, 'Salary' ) ) In [80]: M print(highest_salary[['First Name', 'Gender', 'Salary']]) GenderFemaleMaleNoGender644981746FirstNameKatherineJamesRussellGenderFemaleMaleNoGenderSalary149908148985149456 In [81]: M lowest_salary = group.apply(lambda x: x.nsmallest(1, 'Salary' )) In [82]: M print(lowest_salary[['First Name', 'Gender', 'Salary']]) GenderFemaleMaleNoGender650576417FirstNameCynthiaMichaelSarahGenderFemaleMaleNoGenderSalary353813501337748 In [83]: M group =df. groupby ([ 'Gender' ])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!