ItemsRange ========== .. cpp:class:: pandas::ItemsRange Iterator class for traversing pandas data structures. Example ------- .. code-block:: cpp #include using namespace pandas; // Use ItemsRange ItemsRange obj; // ... operations ... Iteration --------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``ItemsIterator begin() const`` - ItemsIterator - pd_dataframe.h:2107 - :ref:`View ` * - ``ItemsIterator end() const`` - ItemsIterator - pd_dataframe.h:2111 - :ref:`View ` Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``explicit ItemsRange(const DataFrame\* df) : df_(df)`` - explicit ItemsRange(const DataFrame\* df) : - pd_dataframe.h:2105 - Code Examples ------------- The following examples are extracted from the test suite. .. _example-itemsrange-begin-0: .. dropdown:: begin (pd_test_1_all.cpp:457) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 447 :emphasize-lines: 11 }; pandas::CategoricalArray arr(values); const std::vector& cats = arr.categories(); if (cats.size() != 3) { std::cout << " [FAIL] : in pd_test_categorical_array_categories_property() : categories size != 3" << std::endl; throw std::runtime_error("pd_test_categorical_array_categories_property failed: categories size != 3"); } // Categories should be unique std::set unique_cats(cats.begin(), cats.end()); if (unique_cats.size() != cats.size()) { std::cout << " [FAIL] : in pd_test_categorical_array_categories_property() : categories not unique" << std::endl; throw std::runtime_error("pd_test_categorical_array_categories_property failed: categories not unique"); } std::cout << " -> tests passed" << std::endl; } void pd_test_categorical_array_codes_property() { std::cout << "========= CategoricalArray: codes property ======================= "; .. _example-itemsrange-end-1: .. dropdown:: end (pd_test_1_all.cpp:457) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 447 :emphasize-lines: 11 }; pandas::CategoricalArray arr(values); const std::vector& cats = arr.categories(); if (cats.size() != 3) { std::cout << " [FAIL] : in pd_test_categorical_array_categories_property() : categories size != 3" << std::endl; throw std::runtime_error("pd_test_categorical_array_categories_property failed: categories size != 3"); } // Categories should be unique std::set unique_cats(cats.begin(), cats.end()); if (unique_cats.size() != cats.size()) { std::cout << " [FAIL] : in pd_test_categorical_array_categories_property() : categories not unique" << std::endl; throw std::runtime_error("pd_test_categorical_array_categories_property failed: categories not unique"); } std::cout << " -> tests passed" << std::endl; } void pd_test_categorical_array_codes_property() { std::cout << "========= CategoricalArray: codes property ======================= ";