Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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"
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started