change encoding
This commit is contained in:
parent
82b4b3094a
commit
2396d73b2f
@ -1,9 +1,9 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"title": "Python ðàçðàáîò÷èê",
|
"title": "Python разработчик",
|
||||||
"company": "ßíäåêñ",
|
"company": "Яндекс",
|
||||||
"city": "Ìîñêâà",
|
"city": "Москва",
|
||||||
"salary_from": 150000,
|
"salary_from": 150000,
|
||||||
"salary_to": 200000,
|
"salary_to": 200000,
|
||||||
"skills": ["Python", "SQL", "Django", "PostgreSQL"],
|
"skills": ["Python", "SQL", "Django", "PostgreSQL"],
|
||||||
@ -12,8 +12,8 @@
|
|||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"title": "Data Engineer",
|
"title": "Data Engineer",
|
||||||
"company": "Òèíüêîôô",
|
"company": "Тинькофф",
|
||||||
"city": "Ìîñêâà",
|
"city": "Москва",
|
||||||
"salary_from": 180000,
|
"salary_from": 180000,
|
||||||
"salary_to": 250000,
|
"salary_to": 250000,
|
||||||
"skills": ["Python", "SQL", "Spark", "Airflow"],
|
"skills": ["Python", "SQL", "Spark", "Airflow"],
|
||||||
@ -23,7 +23,7 @@
|
|||||||
"id": 3,
|
"id": 3,
|
||||||
"title": "Backend Developer",
|
"title": "Backend Developer",
|
||||||
"company": "Ozon",
|
"company": "Ozon",
|
||||||
"city": "Ñàíêò-Ïåòåðáóðã",
|
"city": "Санкт-Петербург",
|
||||||
"salary_from": 130000,
|
"salary_from": 130000,
|
||||||
"salary_to": 170000,
|
"salary_to": 170000,
|
||||||
"skills": ["Python", "FastAPI", "MongoDB"],
|
"skills": ["Python", "FastAPI", "MongoDB"],
|
||||||
@ -32,8 +32,8 @@
|
|||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"title": "Data Analyst",
|
"title": "Data Analyst",
|
||||||
"company": "ßíäåêñ",
|
"company": "Яндекс",
|
||||||
"city": "Ìîñêâà",
|
"city": "Москва",
|
||||||
"salary_from": 140000,
|
"salary_from": 140000,
|
||||||
"salary_to": 180000,
|
"salary_to": 180000,
|
||||||
"skills": ["Python", "SQL", "Tableau"],
|
"skills": ["Python", "SQL", "Tableau"],
|
||||||
@ -42,8 +42,8 @@
|
|||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
"title": "Junior Python Developer",
|
"title": "Junior Python Developer",
|
||||||
"company": "Ñáåð",
|
"company": "Сбер",
|
||||||
"city": "Ìîñêâà",
|
"city": "Москва",
|
||||||
"salary_from": 100000,
|
"salary_from": 100000,
|
||||||
"salary_to": 130000,
|
"salary_to": 130000,
|
||||||
"skills": ["Python", "SQL", "Git"],
|
"skills": ["Python", "SQL", "Git"],
|
||||||
@ -53,7 +53,7 @@
|
|||||||
"id": 6,
|
"id": 6,
|
||||||
"title": "Senior Python Developer",
|
"title": "Senior Python Developer",
|
||||||
"company": "Wildberries",
|
"company": "Wildberries",
|
||||||
"city": "Ìîñêâà",
|
"city": "Москва",
|
||||||
"salary_from": 200000,
|
"salary_from": 200000,
|
||||||
"salary_to": 300000,
|
"salary_to": 300000,
|
||||||
"skills": ["Python", "SQL", "Kafka", "Kubernetes"],
|
"skills": ["Python", "SQL", "Kafka", "Kubernetes"],
|
||||||
@ -63,7 +63,7 @@
|
|||||||
"id": 7,
|
"id": 7,
|
||||||
"title": "Full Stack Developer",
|
"title": "Full Stack Developer",
|
||||||
"company": "Avito",
|
"company": "Avito",
|
||||||
"city": "Ìîñêâà",
|
"city": "Москва",
|
||||||
"salary_from": 170000,
|
"salary_from": 170000,
|
||||||
"salary_to": 220000,
|
"salary_to": 220000,
|
||||||
"skills": ["Python", "JavaScript", "React", "SQL"],
|
"skills": ["Python", "JavaScript", "React", "SQL"],
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
def load_vacancies(filepath: str) -> list[dict]:
|
def load_vacancies(filepath: str) -> list[dict]:
|
||||||
try:
|
try:
|
||||||
with open(filepath,"r") as file:
|
with open(filepath,"r") as file:
|
||||||
return json.load(file)
|
return json.load(file)
|
||||||
@ -12,9 +12,9 @@ def filter_by_city(vacancies: list[dict], city: str) -> list[dict]:
|
|||||||
def filter_by_skills(vacancies: list[dict], required_skills: list[str]) -> list[dict]:
|
def filter_by_skills(vacancies: list[dict], required_skills: list[str]) -> list[dict]:
|
||||||
return [i for i in vacancies if all(skill.lower() in set(k.lower() for k in i.get('skills')) for skill in required_skills ) ]
|
return [i for i in vacancies if all(skill.lower() in set(k.lower() for k in i.get('skills')) for skill in required_skills ) ]
|
||||||
def filter_by_salary(vacancies: list[dict], min_salary: int) -> list[dict]:
|
def filter_by_salary(vacancies: list[dict], min_salary: int) -> list[dict]:
|
||||||
return [v for v in vacancies if v.get('salary_to') and v.get('salary_from') and v.get('salary_to')>= min_salary and v.get('salary_form')> min_salary]
|
return [v for v in vacancies if v.get('salary_to') and v.get('salary_from') and v.get('salary_to')>= min_salary and v.get('salary_from')> min_salary]
|
||||||
def extract_unique_companies(vacancies: list[dict]) -> list[str]:
|
def extract_unique_companies(vacancies: list[dict]) -> list[str]:
|
||||||
return {v.get('company') for v in vacancies if v.get('company')}
|
return list({v.get('company') for v in vacancies if v.get('company')})
|
||||||
def extract_top_skills(vacancies: list[dict], top_n: int) -> list[tuple[str, int]]:
|
def extract_top_skills(vacancies: list[dict], top_n: int) -> list[tuple[str, int]]:
|
||||||
all_skills = []
|
all_skills = []
|
||||||
for v in vacancies:
|
for v in vacancies:
|
||||||
@ -72,8 +72,11 @@ def main():
|
|||||||
skils_list.append(input(f"Write №{i + 1} skill: "))
|
skils_list.append(input(f"Write №{i + 1} skill: "))
|
||||||
filered_vacancies=filter_by_skills(filered_vacancies,skils_list)
|
filered_vacancies=filter_by_skills(filered_vacancies,skils_list)
|
||||||
filered_vacancies = filter_by_salary(filered_vacancies,int(input("Write salary: ")))
|
filered_vacancies = filter_by_salary(filered_vacancies,int(input("Write salary: ")))
|
||||||
print(format_vacancy_short(x) for x in filered_vacancies)
|
print("Уникальные компании: ", ", ".join(extract_unique_companies(filered_vacancies)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user