NA_t#

class pandas::NA_t#

Utility class for pandas operations.

Example#

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

// Use NA_t
NA_t obj;
// ... operations ...

Conversion#

Signature

Return Type

Location

Example

explicit constexpr operator bool() const noexcept

explicit constexpr operator

pd_na.h:49

View

Other Methods#

Signature

Return Type

Location

Example

std::string repr() const

constexpr bool operator>=(const T&) const noexcept { return false; } std::string

pd_na.h:46

View

Code Examples#

The following examples are extracted from the test suite.

bool (pd_test_3_all.cpp:1568)
1558    }
1559
1560    std::cout << " -> tests passed" << std::endl;
1561}
1562
1563// ============================================================================
1564// Category 9: NA Functions
1565// ============================================================================
1566
1567void pd_test_3_all_na_functions() {
1568    std::cout << "========= NA_t.bool() and is_na<T> ===================";
1569
1570    // Test NA_t bool conversion
1571    pandas::NA_t na_val;
1572    bool na_as_bool = static_cast<bool>(na_val);
1573    if (na_as_bool != false) {
1574        std::cout << "  [FAIL] : in pd_test_3_all_na_functions() : NA should convert to false" << std::endl;
1575        throw std::runtime_error("pd_test_3_all_na_functions failed: NA bool conversion");
1576    }
1577
1578    // Test NA_t equality with itself
repr (pd_test_1_all.cpp:10906)
10896    std::cout << " -> tests passed" << std::endl;
10897}
10898
10899void pd_test_extension_index_repr() {
10900    std::cout << "========= repr =========================";
10901
10902    pandas::CategoricalArray arr({"a", "b", "c"});
10903    // Use ExtensionIndex<CategoricalArray> directly to test base class repr
10904    pandas::ExtensionIndex<pandas::CategoricalArray> idx(arr, "test");
10905
10906    std::string repr_str = idx.repr();
10907
10908    bool passed = (!repr_str.empty() && repr_str.find("ExtensionIndex") != std::string::npos);
10909    if (!passed) {
10910        std::cout << "  [FAIL] : in pd_test_extension_index_repr() : repr check failed" << std::endl;
10911        throw std::runtime_error("pd_test_extension_index_repr failed");
10912    }
10913
10914    std::cout << " -> tests passed" << std::endl;
10915}