ValueError#
-
class pandas::ValueError#
pandas C++ class.
Example#
#include <pandas/pandas.h>
using namespace pandas;
// Use ValueError
ValueError obj;
// ... operations ...
Constructors#
Code Examples#
The following examples are extracted from the test suite.
ValueError (pd_test_5_all.cpp:72279)
72269}
72270
72271void case_5_reindex_migration_acceptance(int& local_fail) {
72272 std::cout << "-- case_5_reindex_migration_acceptance\n";
72273 // Pre-migration form (what the 8 sites currently emit).
72274 const std::string pre_what = "cannot reindex on an axis with duplicate labels";
72275
72276 // Post-migration form (what the registry call emits).
72277 std::string post_what;
72278 try {
72279 throw pandas::ValueError(
72280 std::string(pandas::error_messages::kCannotReindexDuplicate));
72281 } catch (const std::exception& e) {
72282 post_what = e.what();
72283 }
72284 check_eq_str("case_5.reindex_what_byte_equal", pre_what, post_what, local_fail);
72285}
72286
72287void case_6_throw_via_registry(int& local_fail) {
72288 std::cout << "-- case_6_throw_via_registry\n";
72289 std::string caught;
ValueError (pd_test_5_all.cpp:72279)
72269}
72270
72271void case_5_reindex_migration_acceptance(int& local_fail) {
72272 std::cout << "-- case_5_reindex_migration_acceptance\n";
72273 // Pre-migration form (what the 8 sites currently emit).
72274 const std::string pre_what = "cannot reindex on an axis with duplicate labels";
72275
72276 // Post-migration form (what the registry call emits).
72277 std::string post_what;
72278 try {
72279 throw pandas::ValueError(
72280 std::string(pandas::error_messages::kCannotReindexDuplicate));
72281 } catch (const std::exception& e) {
72282 post_what = e.what();
72283 }
72284 check_eq_str("case_5.reindex_what_byte_equal", pre_what, post_what, local_fail);
72285}
72286
72287void case_6_throw_via_registry(int& local_fail) {
72288 std::cout << "-- case_6_throw_via_registry\n";
72289 std::string caught;