ItemsRange#

class pandas::ItemsRange#

Iterator class for traversing pandas data structures.

Example#

#include <pandas/pandas.h>
using namespace pandas;

// Use ItemsRange
ItemsRange obj;
// ... operations ...

Iteration#

Signature

Return Type

Location

Example

ItemsIterator begin() const

ItemsIterator

pd_dataframe.h:2107

View

ItemsIterator end() const

ItemsIterator

pd_dataframe.h:2111

View

Other Methods#

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.

begin (pd_test_1_all.cpp:457)
447        };
448        pandas::CategoricalArray arr(values);
449
450        const std::vector<std::string>& cats = arr.categories();
451        if (cats.size() != 3) {
452            std::cout << "  [FAIL] : in pd_test_categorical_array_categories_property() : categories size != 3" << std::endl;
453            throw std::runtime_error("pd_test_categorical_array_categories_property failed: categories size != 3");
454        }
455
456        // Categories should be unique
457        std::set<std::string> unique_cats(cats.begin(), cats.end());
458        if (unique_cats.size() != cats.size()) {
459            std::cout << "  [FAIL] : in pd_test_categorical_array_categories_property() : categories not unique" << std::endl;
460            throw std::runtime_error("pd_test_categorical_array_categories_property failed: categories not unique");
461        }
462
463        std::cout << " -> tests passed" << std::endl;
464    }
465
466    void pd_test_categorical_array_codes_property() {
467        std::cout << "========= CategoricalArray: codes property ======================= ";
end (pd_test_1_all.cpp:457)
447        };
448        pandas::CategoricalArray arr(values);
449
450        const std::vector<std::string>& cats = arr.categories();
451        if (cats.size() != 3) {
452            std::cout << "  [FAIL] : in pd_test_categorical_array_categories_property() : categories size != 3" << std::endl;
453            throw std::runtime_error("pd_test_categorical_array_categories_property failed: categories size != 3");
454        }
455
456        // Categories should be unique
457        std::set<std::string> unique_cats(cats.begin(), cats.end());
458        if (unique_cats.size() != cats.size()) {
459            std::cout << "  [FAIL] : in pd_test_categorical_array_categories_property() : categories not unique" << std::endl;
460            throw std::runtime_error("pd_test_categorical_array_categories_property failed: categories not unique");
461        }
462
463        std::cout << " -> tests passed" << std::endl;
464    }
465
466    void pd_test_categorical_array_codes_property() {
467        std::cout << "========= CategoricalArray: codes property ======================= ";