Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

korean-holiday-calendar

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

korean-holiday-calendar

korean-specialized holiday calendar based on [python-holidays] package by dr-prodigy

  • 1.0.1
  • PyPI
  • Socket score

Maintainers
2

=============== korean_holiday_calendar

This is a Korean-specialized version of python-holidays package (by dr-prodigy), which contains key functions in existing package, and some new functions for calculating and analysing Korean holidays.

The usage is mostly the same as the existing python-holidays package, so please read its instruction manual for a more complicated usage.

https://python-holidays.readthedocs.io/

Below is a brief instruction manual based on our package.

Quick Start

.. code-block:: python

from datetime import date
import krholidays

kr = krholidays.KR()  # this is a dict
# the below is the same, but takes a string:
kr = krholidays.country_holidays('KR')  # this is a dict

date(2015, 1, 1) in kr  # True
date(2015, 1, 2) in kr  # False
kr.get('2014-01-01')  # "์‹ ์ •"

For English users, we added English options.

.. code-block:: python

kr_holidays_en = holidays.KR(en_name = True)

kr_holidays_en.get('2014-01-01')  # "New Year's Day"

The 'HolidayBase', a dict-like class, will also recognize date strings and Unix timestamps:

.. code-block:: python

'2014-01-01' in krholidays  # True
'1/1/2014' in krholidays    # True
1388597445 in krholidays    # True

Manuals

Example usage:

.. code-block:: python

from krholidays import country_holidays
kr = country_holidays('KR')

The below will cause 2015 holidays to be calculated on the fly:

.. code-block:: python

from datetime import date
date(2015, 1, 1) in kr  # True

The :class:HolidayBase class also recognizes strings of many formats and numbers representing a POSIX timestamp:

assert '2014-01-01' in kr assert '1/1/2014' in kr assert 1388597445 in kr

Show the holiday's name:

.. code-block:: python

kr.get('2014-01-01')   #"New Year's Day"

Check a range:

.. code-block:: python

kr['2014-01-01': '2014-01-03']   #[datetime.date(2014, 1, 1)]

List all 2020 holidays:

.. code-block:: python

kr_2020 = country_holidays('KR', years=2020)
for day in kr_2020.items():
     print(day)

#
(datetime.date(2020, 1, 1), '์‹ ์ •')
(datetime.date(2020, 1, 24), '์„ค๋‚  ์—ฐํœด')
(datetime.date(2020, 1, 25), '์„ค๋‚ ')
(datetime.date(2020, 1, 26), '์„ค๋‚  ์—ฐํœด')
(datetime.date(2020, 1, 27), '์„ค๋‚  ๋Œ€์ฒด๊ณตํœด์ผ')
(datetime.date(2020, 3, 1), '3ยท1์ ˆ')
(datetime.date(2020, 4, 30), '๋ถ€์ฒ˜๋‹˜์˜ค์‹ ๋‚ ')
(datetime.date(2020, 5, 5), '์–ด๋ฆฐ์ด๋‚ ')
(datetime.date(2020, 6, 6), 'ํ˜„์ถฉ์ผ')
(datetime.date(2020, 8, 15), '๊ด‘๋ณต์ ˆ')
(datetime.date(2020, 10, 1), '์ถ”์„')
(datetime.date(2020, 10, 2), '์ถ”์„ ์—ฐํœด')
(datetime.date(2020, 9, 30), '์ถ”์„ ์—ฐํœด')
(datetime.date(2020, 10, 3), '๊ฐœ์ฒœ์ ˆ')
(datetime.date(2020, 10, 9), 'ํ•œ๊ธ€๋‚ ')
(datetime.date(2020, 12, 25), '๊ธฐ๋…ํƒ„์‹ ์ผ')
(datetime.date(2020, 4, 15), '์ œ21๋Œ€ ๊ตญํšŒ์˜์› ์„ ๊ฑฐ์ผ')
(datetime.date(2020, 8, 17), '๊ด‘๋ณต์ ˆ ๊ธฐ๋… (์ž„์‹œ๊ณตํœด์ผ)')

Append custom holiday dates by passing one of:

  • a :class:dict with date/name key/value pairs (e.g. {'2010-07-10': 'My birthday!'}),
  • a list of dates (as a :class:datetime.date, :class:datetime.datetime, :class:str, :class:int, or :class:float); 'Holiday' will be used as a description,
  • or a single date item (of one of the types above);

.. code-block:: python

custom_holidays = country_holidays('US', years=2015)
custom_holidays.update({'2015-01-01': "New Year's Day"})
custom_holidays.update(['2015-07-01', '07/04/2015'])
custom_holidays.update(date(2015, 12, 25))

Newly added functions : import them as you want.

  • count_sun(year), count_sat(year) : Count the number of Sundays / Saturdays for the year.

  • count_holidays(base, year, include_sun = False, include_sat = False) : Count the number of holidays, which add or disable Saturdays and Sundays as you specify.

  • 'base' is 'a HolidayBase object that predetermined in years'.

  • years_graph(start, end, sat = False, sun = False) : Draw a matplotlib.pyplot barplot of the number of holidays between specified year term. You can include Saturday and Sunday options like as count_holidays.

  • months_graph(year) : Draw a matplotlib.pyplot barplot of the number of holidays per month, in a specified year.

License

.. __: LICENSE

Code and documentation are available according to the MIT License (see LICENSE__).

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc