Giter VIP home page Giter VIP logo

rtu-schedule-parser's Introduction

codecov

rtu-schedule-parser

Простое извлечение расписания МИРЭА - Российского Технологического Университета из Excel документов.

Почему rtu-schedule-parser?

  • Строгий формат: Мы стремимся извлечь расписания без неожиданных итогов. Если возникают проблемы при парсинге, выводится ошибка.
  • Выходные данные: Данные расписания легко преобразуются в формат Pandas DataFrame. Это позволяет быстро экспортировать извлеченное расписание в форматы CSV, HTML, XML, JSON и другие, а также выполнять различные операции выборки, сортировки и т.д. с данными.
  • Совместимость: Совместим с форматами документов .xls и .xlsx. Обрабатывает большое количество случаев при парсинге.

Примеры

Пример того, как вы можете загружать документы с расписанием и извлекать расписание для определенной группы. Вы можете увидеть больше примеров здесь.

from rtu_schedule_parser import ExcelScheduleParser, ScheduleData
from rtu_schedule_parser.constants import Institute, Degree
from rtu_schedule_parser.downloader import ScheduleDownloader


# Initialize downloader with default directory to save files
downloader = ScheduleDownloader()

# Get documents for specified institute and degree
docs = downloader.get_documents(specific_institutes={Institute.IIT}, specific_degrees={Degree.BACHELOR})

# Download only if they are not downloaded yet.
downloaded = downloader.download_all(docs)

# Create schedule with downloaded files
schedules = None  # type: ScheduleData | None
for doc in downloaded:
    parser = ExcelScheduleParser(
        doc[1], doc[0].period, doc[0].institute, doc[0].degree
    )
    
    # The `force` argument is used to ignore exceptions during document parsing. 
    # This lets you to parse all possible groups.
    if schedules is None:
        schedules = parser.parse(force=True)
    else:
        schedules.extend(parser.parse(force=True).get_schedule())

# Get a schedule for the specified group
group_schedule = schedules.get_group_schedule("ИКБО-01-22")

# Initialize pandas dataframe
df = group_schedule.get_dataframe()

# Export dataframe to csv
df.to_csv("schedule.csv")

Установка

Из исходного кода

$ git clone https://github.com/mirea-ninja/rtu-schedule-parser

затем установите с помощью pip:

$ cd rtu-schedule-parser
$ python -m pip install .

rtu-schedule-parser's People

Contributors

0niel avatar dragonprod avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.