CellStyle#
-
class pandas::CellStyle#
Styling class for DataFrame rendering.
Example#
#include <pandas/pandas.h>
using namespace pandas;
// Use CellStyle
CellStyle obj;
// ... operations ...
Combining#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
void |
pd_styler.h:75 |
I/O#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
std::string |
pd_styler.h:65 |
Other Methods#
Code Examples#
The following examples are extracted from the test suite.
merge (pd_test_1_all.cpp:13639)
13629namespace dataframe_tests {
13630 namespace dataframe_tests_joining {
13631
13632 // Helper to check approximate equality
13633 bool approx_equal(double a, double b, double tol = 1e-9) {
13634 if (std::isnan(a) && std::isnan(b)) return true;
13635 return std::abs(a - b) < tol;
13636 }
13637
13638 // =====================================================================
13639 // merge() Tests
13640 // =====================================================================
13641
13642 void pd_test_joining_merge_inner() {
13643 std::cout << "========= merge inner join ============================";
13644
13645 // Left DataFrame: id, value_left
13646 std::map<std::string, std::vector<double>> left_data = {
13647 {"id", {1.0, 2.0, 3.0, 4.0}},
13648 {"value_left", {10.0, 20.0, 30.0, 40.0}}
13649 };
empty (pd_test_1_all.cpp:941)
931#include "../pandas/pd_config.h"
932
933namespace dataframe_tests {
934
935namespace dataframe_tests_config {
936
937 void pd_test_config_version() {
938 std::cout << "========= df_config: version info ======================= ";
939 const char* version = pandas::DataFrameInfo::version();
940 if (version == nullptr || std::string(version).empty()) {
941 std::cout << "[FAIL] : in pd_test_config_version() : version is null or empty" << std::endl;
942 throw std::runtime_error("pd_test_config_version failed: version is null or empty");
943 }
944 std::cout << "-> tests passed" << std::endl;
945 }
946
947 void pd_test_config_na_repr() {
948 std::cout << "========= df_config: NA representation ======================= ";
949 const char* na_repr = pandas::DataFrameConfig::get_na_repr();
950 if (na_repr == nullptr) {
set (pd_test_1_all.cpp:16281)
16271 pandas::Attrs attrs;
16272
16273 // Test empty
16274 bool passed = attrs.empty() && attrs.size() == 0;
16275 if (!passed) {
16276 std::cout << " [FAIL] : in pd_test_ndframe_attrs() : empty attrs" << std::endl;
16277 throw std::runtime_error("pd_test_ndframe_attrs failed: empty attrs");
16278 }
16279
16280 // Test set/get string
16281 attrs.set("author", std::string("John Doe"));
16282 passed = attrs.contains("author") && attrs.get<std::string>("author") == "John Doe";
16283 if (!passed) {
16284 std::cout << " [FAIL] : in pd_test_ndframe_attrs() : set/get string" << std::endl;
16285 throw std::runtime_error("pd_test_ndframe_attrs failed: set/get string");
16286 }
16287
16288 // Test set/get double
16289 attrs.set("version", 1.5);
16290 passed = std::abs(attrs.get<double>("version") - 1.5) < 1e-10;
16291 if (!passed) {