def predict_rub_salary_hh(language): vacancies = get_vacancies_hh(language) salaries = [] for vacancy in vacancies: if vacancy['salary']['currency'] == 'RUR': salary = predict_salary(vacancy['salary']['from'], vacancy['salary']['to']) salaries.append(salary) return { 'vacancies_found': len(vacancies), 'vacancies_processed': len(salaries), 'average_salary': int(statistics.mean(salaries)) }
def predict_rub_salary_sj(vacancy_description): """Predict salary in rubles given a vacancy description. :param vacancy_description: vacancy description :return: predicted salary """ if vacancy_description.get("currency") != "rub": return None salary_from = vacancy_description.get("payment_from") salary_to = vacancy_description.get("payment_to") return predict_salary(salary_from, salary_to)
def predict_rub_salary_sj(secret_key, language): vacancies = get_vacancies_sj(secret_key, language) salaries = [] for vacancy in vacancies: if vacancy['currency'] == 'rub' and (vacancy['payment_from'] or vacancy['payment_to']): salary = predict_salary(vacancy['payment_from'], vacancy['payment_to']) salaries.append(salary) return { 'vacancies_found': len(vacancies), 'vacancies_processed': len(salaries), 'average_salary': int(statistics.mean(salaries)) }
def predict_rub_salary_hh(salary_fork): """Predict salary in rubles given a salary fork. :param salary_fork: salary fork :return: predicted salary """ if not salary_fork: return None if salary_fork.get("currency") != "RUR": return None salary_from = salary_fork.get("from") salary_to = salary_fork.get("to") return predict_salary(salary_from, salary_to)
def predict_rub_salary_for_headhunter(vacancy): vacancy_salary = vacancy["salary"] if vacancy_salary and vacancy_salary["currency"] == "RUR": return predict_salary(vacancy_salary["from"], vacancy_salary["to"])
def predict_rub_salary_for_superjob(vacancy): if vacancy["currency"] == "rub": return predict_salary(vacancy["payment_from"], vacancy["payment_to"])