StringFormatter#
-
class pandas::StringFormatter#
pandas C++ class.
Example#
#include <pandas/pandas.h>
using namespace pandas;
// Use StringFormatter
StringFormatter obj;
// ... operations ...
Constructors#
Signature |
Location |
Example |
|---|---|---|
|
pd_string_formatter.h:42 |
I/O#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
std::string |
pd_string_formatter.h:57 |
Other Methods#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
size_t |
pd_string_formatter.h:46 |
|
|
const DisplayConfig& |
pd_string_formatter.h:45 |
Internal Methods#
8 internal methods (prefixed with underscore)
Code Examples#
The following examples are extracted from the test suite.
to_string (pd_test_1_all.cpp:2693)
2683 pandas::PeriodArray arr_m(std::vector<std::string>{
2684 "2020-01",
2685 "NaT",
2686 "2025-06"
2687 }, "M");
2688
2689 // Year
2690 auto years = arr_m.year();
2691 auto y0 = years[0];
2692 if (!y0.has_value() || y0.value() != 2020) {
2693 std::cout << " [FAIL] : year[0] should be 2020, got " << (y0.has_value() ? std::to_string(y0.value()) : "NA") << std::endl;
2694 throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[0]");
2695 }
2696
2697 auto y1 = years[1];
2698 if (y1.has_value()) {
2699 std::cout << " [FAIL] : year[1] should be NA (NaT)" << std::endl;
2700 throw std::runtime_error("pd_test_period_array_year_month_quarter failed: year[1] should be NA");
2701 }
2702
2703 auto y2 = years[2];