'>' not supported between instances of 'list' and 'str'

Viewed 36

I'm trying to debug a simple function in python, I kind of know what is the reason for the error but I'm not being able to overcome this error, I believe I need to convert the values that are being compared or breakdown the condition into two pieces, since I'm comparing a value to a list of value, but I don't know how to do that:

def get_num_hired_before_optimized(employee_id):
    
    # get the department of the employee_id
    emp_val = input_data[input_data["employee_id"]==employee_id][["department_id","hire_date"]].values[0]
    print(emp_val)
    
    # get the data for the department
    input_data_dept = input_data[input_data["department_id"]==emp_val[0]][["hire_date"]>emp_val[1]]
    return input_data_dept
error message is: '>' not supported between instances of 'list' and 'str'
0 Answers
Related