ApplyResultInference#

class pandas::ApplyResultInference#

pandas C++ class.

Example#

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

// Use ApplyResultInference
ApplyResultInference obj;
// ... operations ...

Other Methods#

Signature

Return Type

Location

Example

static ApplyResultKind classify(const ProbeDescriptor& probe, const std::string& source_dtype)

static ApplyResultKind

pd_apply_result.h:519

View

static void finalize_numeric(SeriesT& res, const std::string& source_dtype, bool all_results_int)

void

pd_apply_result.h:531

static void observe_probe(ScalarKindHistogram& hist, const ProbeDescriptor& d)

static void

pd_apply_result.h:401

View

static std::string pandas_apply_widen_narrow(const std::string& a, const std::string& b)

static std::string

pd_apply_result.h:347

Code Examples#

The following examples are extracted from the test suite.

classify (pd_test_5_all.cpp:126920)
126910// --- f_test_is_numeric_extension_dtypes_2.cpp ---
126911
126912namespace f_test_is_numeric_extension_dtypes_2_ns {
126913
126914static bool inline_is_numeric_two_term(const std::string& dt) {
126915    return (dt.find("float") != std::string::npos ||
126916            dt.find("int")   != std::string::npos);
126917}
126918
126919static void classify(const std::string& dt,
126920                     bool expect_two_term,
126921                     bool expect_central,
126922                     const std::string& label_prefix,
126923                     int& local_fail) {
126924    bool two_term = inline_is_numeric_two_term(dt);
126925    bool central  = pandas::DataFrame::is_numeric_dtype(dt);
126926    pandas_tests::check(two_term == expect_two_term,
126927          label_prefix + ".two_term_classifies_as_expected (dt=" + dt + ")",
126928          local_fail);
126929    pandas_tests::check(central == expect_central,
observe_probe (pd_test_5_all.cpp:97995)
97985                                   std::string("c")});
97986    // Match pandas' Series<string> short dtype convention.
97987    s.set_dtype_override("object");
97988    return s;
97989}
97990
97991static Cb cb_int(Hist& hist) {
97992    return [&hist](const pandas::MapCellInput& in) {
97993        pandas::ApplyResultInference::ProbeDescriptor d;
97994        d.is_int = true;
97995        pandas::ApplyResultInference::observe_probe(hist, d);
97996        (void)in;
97997        return pandas::ApplyCellResult::of_int(42);
97998    };
97999}
98000
98001static Cb cb_bool(Hist& hist) {
98002    return [&hist](const pandas::MapCellInput& in) {
98003        pandas::ApplyResultInference::ProbeDescriptor d;
98004        d.is_bool = true;
98005        pandas::ApplyResultInference::observe_probe(hist, d);