BoolColumnRefNode ================= .. cpp:class:: pandas::BoolColumnRefNode pandas C++ class. Example ------- .. code-block:: cpp #include using namespace pandas; // Use BoolColumnRefNode BoolColumnRefNode obj; // ... operations ... Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``explicit BoolColumnRefNode(std::string col) : column(std::move(col))`` - explicit BoolColumnRefNode(std::string col) : - pd_query.h:358 - :ref:`View ` * - ``NodeType type() const override`` - NodeType - pd_query.h:357 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-boolcolumnrefnode-column-0: .. dropdown:: column (pd_test_1_all.cpp:22039) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 22029 :emphasize-lines: 11 std::string a1 = result.iat(1, col_a_idx) == -1.0 ? "ok" : "fail"; std::string a2 = result.iat(2, col_a_idx) == 3.0 ? "ok" : "fail"; std::string a3 = result.iat(3, col_a_idx) == 4.0 ? "ok" : "fail"; if (a0 != "ok" || a1 != "ok" || a2 != "ok" || a3 != "ok") { passed = false; error_msg = "Column A values incorrect: A[0]=" + a0 + ", A[1]=" + a1 + ", A[2]=" + a2 + ", A[3]=" + a3; } // Check B column (all should be original) double b0 = result.iat(0, col_b_idx); if (b0 != 5.0) { passed = false; error_msg = "B[0] should be 5, got " + std::to_string(b0); } if (!passed) { std::cout << " [FAIL] : in pd_test_where_basic() : " << error_msg << std::endl; throw std::runtime_error("pd_test_where_basic failed: " + error_msg); } .. _example-boolcolumnrefnode-type-1: .. dropdown:: type (pd_test_3_all.cpp:15450) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 15440 :emphasize-lines: 11 /** * Test Series.convert_dtypes() parameter flags */ void pd_test_series_convert_dtypes_flags() { std::cout << "========= Series.convert_dtypes() flags ================="; // Test convert_integer=false - with floats disabled too, so it becomes string/object pandas::Series s({"1", "2", "3"}, "numbers"); auto converted = s.convert_dtypes(true, true, false, true, false); // convert_integer=false, convert_floating=false // Should remain object type (Series has dtype_name()="object") // When integer and floating are both disabled for integer-like strings, it falls back to string type if (converted->dtype_name() != "object") { std::cout << " [FAIL] : dtype should be object when convert_integer=false and convert_floating=false, got " << converted->dtype_name() << std::endl; throw std::runtime_error("pd_test_series_convert_dtypes_flags failed: convert_integer"); } // Test convert_boolean=false - strings stay as object/string type pandas::Series s_bool({"true", "false"}, "bools"); auto converted_bool = s_bool.convert_dtypes(true, true, true, false, true); // convert_boolean=false