TuplesRange#

class pandas::TuplesRange#

Iterator class for traversing pandas data structures.

Example#

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

// Use TuplesRange
TuplesRange obj;
// ... operations ...

Constructors#

Signature

Location

Example

TuplesRange(const DataFrame\* df, bool include_index, const std::string& name)

pd_dataframe.h:2441

Iteration#

Signature

Return Type

Location

Example

TupleIterator begin() const

TupleIterator

pd_dataframe.h:2444

View

TupleIterator end() const

TupleIterator

pd_dataframe.h:2448

View

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 ======================= ";