BusdayCalendar ============== .. cpp:class:: numpy::BusdayCalendar numpy C++ class. Example ------- .. code-block:: cpp #include using namespace numpy; // Use BusdayCalendar BusdayCalendar obj; // ... operations ... Constructors ------------ .. list-table:: :widths: 55 25 20 :header-rows: 1 * - Signature - Location - Example * - ``BusdayCalendar(const Weekmask &weekmask = default_weekmask(), const std::set&holidays = {})`` - NP_DATETIME_UTILS.H:114 - * - ``BusdayCalendar(const std::string &weekmask_str, const std::set&holidays = {})`` - NP_DATETIME_UTILS.H:118 - Indexing / Selection -------------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``const std::set& getHolidays()`` - const std::set& - NP_DATETIME_UTILS.H:123 - * - ``const Weekmask & getWeekmask()`` - const Weekmask & - NP_DATETIME_UTILS.H:122 - Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``bool isBusinessDay(const datetime64 &date)`` - bool - NP_DATETIME_UTILS.H:125 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-busdaycalendar-isbusinessday-0: .. dropdown:: isBusinessDay (np_test_1_all.cpp:6952) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 6942 :emphasize-lines: 11 std::cout << " -> tests passed" << std::endl; } void testDatetimeUtilsDateTime() { std::cout << "========= testDatetimeUtilsDateTime ======================="; datetime64 test_date("2024-03-15"); // Friday // std::cout << "Test date: " << test_date.toString() << std::endl; // std::cout << "Is weekend: " << datetime_utils::isWeekend(test_date) << std::endl; // std::cout << "Is business day: " << datetime_utils::isBusinessDay(test_date) << std::endl; // std::cout << "Weekday: " << datetime_utils::getWeekday(test_date) << std::endl; // std::cout << "Day of year: " << datetime_utils::getDayOfYear(test_date) << std::endl; // Test start/end of periods // std::cout << "Start of week: " << datetime_utils::startOfWeek(test_date).toString() << std::endl; // std::cout << "End of week: " << datetime_utils::endOfWeek(test_date).toString() << std::endl; // std::cout << "Start of month: " << datetime_utils::startOfMonth(test_date).toString() << std::endl; // std::cout << "End of month: " << datetime_utils::endOfMonth(test_date).toString() << std::endl; // Test business day calculations