NullableString#

class pandas::NullableString#

pandas C++ class.

Example#

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

// Use NullableString
NullableString obj;
// ... operations ...

Other Methods#

Signature

Return Type

Location

Example

bool has_value() const { return value.has_value()

bool

pd_nullable.h:53

View

NullableString(const char\* s) : value(s ? std::optional<std::string>(s) : std::nullopt)

NullableString(const char* s) :

pd_nullable.h:49

View

NullableString(const std::string& s) : value(s)

NullableString(const std::string& s) :

pd_nullable.h:50

View

NullableString(std::nullopt_t) : value(std::nullopt)

NullableString(std::nullopt_t) :

pd_nullable.h:52

View

Code Examples#

The following examples are extracted from the test suite.

has_value (pd_test_1_all.cpp:88)
78        // T & T = T, T & F = F, T & NA = NA
79        // F & T = F, F & F = F, F & NA = F (False dominates)
80        // NA & T = NA, NA & F = F, NA & NA = NA
81
82        pandas::BooleanArray t({std::optional<bool>(true)});
83        pandas::BooleanArray f({std::optional<bool>(false)});
84        pandas::BooleanArray na({std::nullopt});
85
86        // T & T = T
87        auto tt = (t & t);
88        if (!tt[0].has_value() || !tt[0].value()) {
89            std::cout << "  [FAIL] : in pd_test_boolean_array_kleene_and() : T & T should be T" << std::endl;
90            throw std::runtime_error("pd_test_boolean_array_kleene_and failed: T & T");
91        }
92
93        // T & F = F
94        auto tf = (t & f);
95        if (!tf[0].has_value() || tf[0].value()) {
96            std::cout << "  [FAIL] : in pd_test_boolean_array_kleene_and() : T & F should be F" << std::endl;
97            throw std::runtime_error("pd_test_boolean_array_kleene_and failed: T & F");
98        }
value (pd_test_1_all.cpp:88)
78        // T & T = T, T & F = F, T & NA = NA
79        // F & T = F, F & F = F, F & NA = F (False dominates)
80        // NA & T = NA, NA & F = F, NA & NA = NA
81
82        pandas::BooleanArray t({std::optional<bool>(true)});
83        pandas::BooleanArray f({std::optional<bool>(false)});
84        pandas::BooleanArray na({std::nullopt});
85
86        // T & T = T
87        auto tt = (t & t);
88        if (!tt[0].has_value() || !tt[0].value()) {
89            std::cout << "  [FAIL] : in pd_test_boolean_array_kleene_and() : T & T should be T" << std::endl;
90            throw std::runtime_error("pd_test_boolean_array_kleene_and failed: T & T");
91        }
92
93        // T & F = F
94        auto tf = (t & f);
95        if (!tf[0].has_value() || tf[0].value()) {
96            std::cout << "  [FAIL] : in pd_test_boolean_array_kleene_and() : T & F should be F" << std::endl;
97            throw std::runtime_error("pd_test_boolean_array_kleene_and failed: T & F");
98        }
value (pd_test_1_all.cpp:88)
78        // T & T = T, T & F = F, T & NA = NA
79        // F & T = F, F & F = F, F & NA = F (False dominates)
80        // NA & T = NA, NA & F = F, NA & NA = NA
81
82        pandas::BooleanArray t({std::optional<bool>(true)});
83        pandas::BooleanArray f({std::optional<bool>(false)});
84        pandas::BooleanArray na({std::nullopt});
85
86        // T & T = T
87        auto tt = (t & t);
88        if (!tt[0].has_value() || !tt[0].value()) {
89            std::cout << "  [FAIL] : in pd_test_boolean_array_kleene_and() : T & T should be T" << std::endl;
90            throw std::runtime_error("pd_test_boolean_array_kleene_and failed: T & T");
91        }
92
93        // T & F = F
94        auto tf = (t & f);
95        if (!tf[0].has_value() || tf[0].value()) {
96            std::cout << "  [FAIL] : in pd_test_boolean_array_kleene_and() : T & F should be F" << std::endl;
97            throw std::runtime_error("pd_test_boolean_array_kleene_and failed: T & F");
98        }
value (pd_test_1_all.cpp:88)
78        // T & T = T, T & F = F, T & NA = NA
79        // F & T = F, F & F = F, F & NA = F (False dominates)
80        // NA & T = NA, NA & F = F, NA & NA = NA
81
82        pandas::BooleanArray t({std::optional<bool>(true)});
83        pandas::BooleanArray f({std::optional<bool>(false)});
84        pandas::BooleanArray na({std::nullopt});
85
86        // T & T = T
87        auto tt = (t & t);
88        if (!tt[0].has_value() || !tt[0].value()) {
89            std::cout << "  [FAIL] : in pd_test_boolean_array_kleene_and() : T & T should be T" << std::endl;
90            throw std::runtime_error("pd_test_boolean_array_kleene_and failed: T & T");
91        }
92
93        // T & F = F
94        auto tf = (t & f);
95        if (!tf[0].has_value() || tf[0].value()) {
96            std::cout << "  [FAIL] : in pd_test_boolean_array_kleene_and() : T & F should be F" << std::endl;
97            throw std::runtime_error("pd_test_boolean_array_kleene_and failed: T & F");
98        }