How to do it...

  1. Read in the employee data, assign the chosen departments, and import columns to variables:
>>> employee = pd.read_csv('data/employee.csv')
>>> depts = ['Houston Police Department-HPD',
'Houston Fire Department (HFD)']
>>> select_columns = ['UNIQUE_ID', 'DEPARTMENT',
'GENDER', 'BASE_SALARY']
  1. Build the query string and execute the method:
>>> qs = "DEPARTMENT in @depts " 
"and GENDER == 'Female' "
"and 80000 <= BASE_SALARY <= 120000"

>>> emp_filtered = employee.query(qs)
>>> emp_filtered[select_columns].head()
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.36.146