/ Python And R Data science skills: 62 csv file read home work 03

Saturday 10 February 2018

62 csv file read home work 03

https://vlrtraining.com/courses/python-data-science-beginner-tutorial 62 csv file read home work 03
In [1]:
import pandas as pd
sal = pd.read_csv('Salaries.csv')

What is the name of lowest paid person (including benefits)? Do you notice something strange about how much he or she is paid?

sal[sal['TotalPayBenefits']== sal['TotalPayBenefits'].min()] #['EmployeeName']

or

sal.loc[sal['TotalPayBenefits'].idxmax()]['EmployeeName']
In [2]:
sal['TotalPayBenefits'].min()
Out[2]:
-618.13
In [3]:
sal[sal['TotalPayBenefits']== sal['TotalPayBenefits'].min()] #['EmployeeName']
Out[3]:
Id EmployeeName JobTitle BasePay OvertimePay OtherPay Benefits TotalPay TotalPayBenefits Year Notes Agency Status
148653 148654 Joe Lopez Counselor, Log Cabin Ranch 0.0 0.0 -618.13 0.0 -618.13 -618.13 2014 NaN San Francisco NaN
In [4]:
sal[sal['TotalPayBenefits']== sal['TotalPayBenefits'].min()] ['EmployeeName']
Out[4]:
148653    Joe Lopez
Name: EmployeeName, dtype: object
In [6]:
sal.loc[sal['TotalPayBenefits'].idxmin()]['EmployeeName']
Out[6]:
'Joe Lopez'

No comments:

Post a Comment