Answered step by step
Verified Expert Solution
Link Copied!

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"

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions