KeyError#
-
class pandas::KeyError#
pandas C++ class.
Example#
#include <pandas/pandas.h>
using namespace pandas;
// Use KeyError
KeyError obj;
// ... operations ...
Constructors#
Code Examples#
The following examples are extracted from the test suite.
KeyError (pd_test_5_all.cpp:72949)
72939 local_fail);
72940}
72941
72942void case_12_key_error_typed_throw_and_isolation(int& local_fail) {
72943 std::cout << "-- case_12_key_error_typed_throw_and_isolation\n";
72944 static_assert(std::is_base_of_v<std::out_of_range, pandas::KeyError>,
72945 "pandas::KeyError must inherit std::out_of_range");
72946
72947 std::string caught;
72948 try {
72949 throw pandas::KeyError(
72950 std::string(pandas::error_messages::kLabelNotFoundInIndex));
72951 } catch (const std::exception& e) {
72952 caught = e.what();
72953 }
72954 check_eq_str(
72955 "case_12.KeyError_round_trip",
72956 "Label not found in index",
72957 caught,
72958 local_fail);
KeyError (pd_test_5_all.cpp:72949)
72939 local_fail);
72940}
72941
72942void case_12_key_error_typed_throw_and_isolation(int& local_fail) {
72943 std::cout << "-- case_12_key_error_typed_throw_and_isolation\n";
72944 static_assert(std::is_base_of_v<std::out_of_range, pandas::KeyError>,
72945 "pandas::KeyError must inherit std::out_of_range");
72946
72947 std::string caught;
72948 try {
72949 throw pandas::KeyError(
72950 std::string(pandas::error_messages::kLabelNotFoundInIndex));
72951 } catch (const std::exception& e) {
72952 caught = e.what();
72953 }
72954 check_eq_str(
72955 "case_12.KeyError_round_trip",
72956 "Label not found in index",
72957 caught,
72958 local_fail);