TypeError#

class pandas::TypeError#

pandas C++ class.

Example#

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

// Use TypeError
TypeError obj;
// ... operations ...

Constructors#

Signature

Location

Example

explicit TypeError(const std::string& msg) : std::invalid_argument(msg)

pd_exceptions.h:16

View

explicit TypeError(const char\* msg) : std::invalid_argument(msg)

pd_exceptions.h:17

View

Code Examples#

The following examples are extracted from the test suite.

TypeError (pd_test_5_all.cpp:74328)
74318        big, "int64", "col", 0, "reason");
74319    pandas_tests::check(out2.find(big) != std::string::npos,
74320                        "case_7.long_value_contains_input", local_fail);
74321}
74322
74323void case_8_throw_via_registry_typeerror(int& local_fail) {
74324    std::cout << "-- case_8_throw_via_registry_typeerror\n";
74325    {
74326        std::string caught;
74327        try {
74328            throw pandas::TypeError(
74329                pandas::error_messages::unsupported_dtype("category"));
74330        } catch (const std::exception& e) {
74331            caught = e.what();
74332        }
74333        check_eq_str("case_8.TypeError_unsupported_dtype_round_trip",
74334                     "Unsupported dtype: category", caught, local_fail);
74335    }
74336    {
74337        std::string caught;
74338        try {
TypeError (pd_test_5_all.cpp:74328)
74318        big, "int64", "col", 0, "reason");
74319    pandas_tests::check(out2.find(big) != std::string::npos,
74320                        "case_7.long_value_contains_input", local_fail);
74321}
74322
74323void case_8_throw_via_registry_typeerror(int& local_fail) {
74324    std::cout << "-- case_8_throw_via_registry_typeerror\n";
74325    {
74326        std::string caught;
74327        try {
74328            throw pandas::TypeError(
74329                pandas::error_messages::unsupported_dtype("category"));
74330        } catch (const std::exception& e) {
74331            caught = e.what();
74332        }
74333        check_eq_str("case_8.TypeError_unsupported_dtype_round_trip",
74334                     "Unsupported dtype: category", caught, local_fail);
74335    }
74336    {
74337        std::string caught;
74338        try {