DuplicateLabelError#

class pandas::DuplicateLabelError#

pandas C++ class.

Example#

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

// Use DuplicateLabelError
DuplicateLabelError obj;
// ... operations ...

Constructors#

Signature

Location

Example

explicit DuplicateLabelError(const std::string& msg) : std::runtime_error(msg)

pd_exceptions.h:72

View

explicit DuplicateLabelError(const char\* msg) : std::runtime_error(msg)

pd_exceptions.h:73

View

Code Examples#

The following examples are extracted from the test suite.

DuplicateLabelError (pd_test_5_all.cpp:72295)
72285}
72286
72287void case_6_throw_via_registry(int& local_fail) {
72288    std::cout << "-- case_6_throw_via_registry\n";
72289    std::string caught;
72290    try {
72291        // DuplicateLabelError currently lives in pandasPython/
72292        // bindings_common.h; plan_88a moves it into pandas::. If
72293        // plan_88a hasn't landed yet this is a compile error and
72294        // documents the dependency.
72295        throw pandas::DuplicateLabelError(
72296            std::string(pandas::error_messages::kCannotReindexDuplicate));
72297    } catch (const std::exception& e) {
72298        caught = e.what();
72299    }
72300    check_eq_str(
72301        "case_6.DuplicateLabelError_round_trip",
72302        "cannot reindex on an axis with duplicate labels",
72303        caught,
72304        local_fail);
72305}
DuplicateLabelError (pd_test_5_all.cpp:72295)
72285}
72286
72287void case_6_throw_via_registry(int& local_fail) {
72288    std::cout << "-- case_6_throw_via_registry\n";
72289    std::string caught;
72290    try {
72291        // DuplicateLabelError currently lives in pandasPython/
72292        // bindings_common.h; plan_88a moves it into pandas::. If
72293        // plan_88a hasn't landed yet this is a compile error and
72294        // documents the dependency.
72295        throw pandas::DuplicateLabelError(
72296            std::string(pandas::error_messages::kCannotReindexDuplicate));
72297    } catch (const std::exception& e) {
72298        caught = e.what();
72299    }
72300    check_eq_str(
72301        "case_6.DuplicateLabelError_round_trip",
72302        "cannot reindex on an axis with duplicate labels",
72303        caught,
72304        local_fail);
72305}