CellStyle ========= .. cpp:class:: pandas::CellStyle Styling class for DataFrame rendering. Example ------- .. code-block:: cpp #include using namespace pandas; // Use CellStyle CellStyle obj; // ... operations ... Combining --------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``void merge(const CellStyle& other)`` - void - pd_styler.h:75 - :ref:`View ` I/O --- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``std::string to_css() const`` - std::string - pd_styler.h:65 - Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``bool empty() const { return properties.empty()`` - bool - pd_styler.h:81 - :ref:`View ` * - ``void set(const std::string& prop, const std::string& value)`` - void - pd_styler.h:61 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-cellstyle-merge-0: .. dropdown:: merge (pd_test_1_all.cpp:13639) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 13629 :emphasize-lines: 11 namespace dataframe_tests { namespace dataframe_tests_joining { // Helper to check approximate equality bool approx_equal(double a, double b, double tol = 1e-9) { if (std::isnan(a) && std::isnan(b)) return true; return std::abs(a - b) < tol; } // ===================================================================== // merge() Tests // ===================================================================== void pd_test_joining_merge_inner() { std::cout << "========= merge inner join ============================"; // Left DataFrame: id, value_left std::map> left_data = { {"id", {1.0, 2.0, 3.0, 4.0}}, {"value_left", {10.0, 20.0, 30.0, 40.0}} }; .. _example-cellstyle-empty-1: .. dropdown:: empty (pd_test_1_all.cpp:941) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 931 :emphasize-lines: 11 #include "../pandas/pd_config.h" namespace dataframe_tests { namespace dataframe_tests_config { void pd_test_config_version() { std::cout << "========= df_config: version info ======================= "; const char* version = pandas::DataFrameInfo::version(); if (version == nullptr || std::string(version).empty()) { std::cout << "[FAIL] : in pd_test_config_version() : version is null or empty" << std::endl; throw std::runtime_error("pd_test_config_version failed: version is null or empty"); } std::cout << "-> tests passed" << std::endl; } void pd_test_config_na_repr() { std::cout << "========= df_config: NA representation ======================= "; const char* na_repr = pandas::DataFrameConfig::get_na_repr(); if (na_repr == nullptr) { .. _example-cellstyle-set-2: .. dropdown:: set (pd_test_1_all.cpp:16281) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 16271 :emphasize-lines: 11 pandas::Attrs attrs; // Test empty bool passed = attrs.empty() && attrs.size() == 0; if (!passed) { std::cout << " [FAIL] : in pd_test_ndframe_attrs() : empty attrs" << std::endl; throw std::runtime_error("pd_test_ndframe_attrs failed: empty attrs"); } // Test set/get string attrs.set("author", std::string("John Doe")); passed = attrs.contains("author") && attrs.get("author") == "John Doe"; if (!passed) { std::cout << " [FAIL] : in pd_test_ndframe_attrs() : set/get string" << std::endl; throw std::runtime_error("pd_test_ndframe_attrs failed: set/get string"); } // Test set/get double attrs.set("version", 1.5); passed = std::abs(attrs.get("version") - 1.5) < 1e-10; if (!passed) {