Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. wb = load_workbook('./salaries.xlsx')
  2. sheet = wb.get_sheet_by_name('Лист1')
  3. salaries = list()
  4.  
  5. for cellObj in sheet['B2':'H9']:
  6.     for cell in cellObj:
  7.         position = sheet[cell.column + '1'].value
  8.         area = sheet['A' + str(cell.row)].value
  9.         salaries.append([cell.value, area, position])
  10.  
  11. l = len(salaries)
  12. medianSalary = list()
  13. for i in range(0,l - 6,7):
  14.     city = salaries[i: i + 7]
  15.     city.sort(key = lambda item: item[0])
  16.     medianSalary.append([city[3][0], city[3][1]])
  17. print(medianSalary)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement