Python Forum
Greater Than - Less Than
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Greater Than - Less Than
#2
Your program is comparing floating point numbers as strings.
e.g.: if EID1APro >= proavg1:

EID1APro and proavg1 are strings.

'9.00%' >= '10.00%'
Output:
True
Normally you put code like this into functions:


def invoices_per_employee(employees, total_invoices):
    avg_processed = np.mean(list(employees.values()))
    avg_total = avg_processed / total_invoices * 100
    for name, processes_invoices in employees.items():
        processed = processes_invoices / total_invoices * 100
        yield name, avg_processed, avg_total, processes_invoices, processed, processed > avg_total

emp = {'David': 170, 'Lisa': 50}
total = 1700

list(invoices_per_employee(emp, total))
Think about better variable names.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
Greater Than - Less Than - by stilllearning - Dec-05-2017, 03:52 AM
RE: Greater Than - Less Than - by DeaD_EyE - Dec-05-2017, 11:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  F-score and Recall values Greater Than 1 Hani 5 2,534 May-13-2020, 01:47 AM
Last Post: Hani

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020