TuplesRange =========== .. cpp:class:: pandas::TuplesRange Iterator class for traversing pandas data structures. Example ------- .. code-block:: cpp #include using namespace pandas; // Use TuplesRange TuplesRange obj; // ... operations ... Constructors ------------ .. list-table:: :widths: 55 25 20 :header-rows: 1 * - Signature - Location - Example * - ``TuplesRange(const DataFrame\* df, bool include_index, const std::string& name)`` - pd_dataframe.h:2441 - Iteration --------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``TupleIterator begin() const`` - TupleIterator - pd_dataframe.h:2444 - :ref:`View ` * - ``TupleIterator end() const`` - TupleIterator - pd_dataframe.h:2448 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-tuplesrange-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-tuplesrange-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 ======================= ";