UnsortedIndexError ================== .. cpp:class:: pandas::UnsortedIndexError pandas C++ class. Example ------- .. code-block:: cpp #include using namespace pandas; // Create UnsortedIndexError UnsortedIndexError idx({1, 2, 3}, "my_index"); size_t len = idx.size(); Constructors ------------ .. list-table:: :widths: 55 25 20 :header-rows: 1 * - Signature - Location - Example * - ``explicit UnsortedIndexError(const std::string& msg) : std::runtime_error(msg)`` - pd_exceptions.h:91 - :ref:`View ` * - ``explicit UnsortedIndexError(const char\* msg) : std::runtime_error(msg)`` - pd_exceptions.h:92 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-unsortedindexerror-unsortedindexerror-0: .. dropdown:: UnsortedIndexError (pd_test_5_all.cpp:73561) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 73551 :emphasize-lines: 11 pandas_tests::check( has_no_trailing_ws_ui( pandas::error_messages::unsorted_index_key_vs_depth(7, 1)), "case_3.unsorted_index_key_vs_depth_no_trail", local_fail); } void case_4_unsorted_index_error_roundtrip(int& local_fail) { std::cout << "-- case_4_unsorted_index_error_roundtrip\n"; std::string caught; try { throw pandas::UnsortedIndexError( pandas::error_messages::unsorted_index_key_vs_depth(2, 0)); } catch (const pandas::UnsortedIndexError& e) { caught = e.what(); } check_eq_str_ui("case_4.UnsortedIndexError_what_roundtrip", "Key length (2) was greater than MultiIndex lexsort depth (0)", caught, local_fail); } .. _example-unsortedindexerror-unsortedindexerror-1: .. dropdown:: UnsortedIndexError (pd_test_5_all.cpp:73561) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 73551 :emphasize-lines: 11 pandas_tests::check( has_no_trailing_ws_ui( pandas::error_messages::unsorted_index_key_vs_depth(7, 1)), "case_3.unsorted_index_key_vs_depth_no_trail", local_fail); } void case_4_unsorted_index_error_roundtrip(int& local_fail) { std::cout << "-- case_4_unsorted_index_error_roundtrip\n"; std::string caught; try { throw pandas::UnsortedIndexError( pandas::error_messages::unsorted_index_key_vs_depth(2, 0)); } catch (const pandas::UnsortedIndexError& e) { caught = e.what(); } check_eq_str_ui("case_4.UnsortedIndexError_what_roundtrip", "Key length (2) was greater than MultiIndex lexsort depth (0)", caught, local_fail); }