ApplyResultInference ==================== .. cpp:class:: pandas::ApplyResultInference pandas C++ class. Example ------- .. code-block:: cpp #include using namespace pandas; // Use ApplyResultInference ApplyResultInference obj; // ... operations ... Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``static ApplyResultKind classify(const ProbeDescriptor& probe, const std::string& source_dtype)`` - static ApplyResultKind - pd_apply_result.h:519 - :ref:`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 - :ref:`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. .. _example-applyresultinference-classify-0: .. dropdown:: classify (pd_test_5_all.cpp:126920) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 126910 :emphasize-lines: 11 // --- f_test_is_numeric_extension_dtypes_2.cpp --- namespace f_test_is_numeric_extension_dtypes_2_ns { static bool inline_is_numeric_two_term(const std::string& dt) { return (dt.find("float") != std::string::npos || dt.find("int") != std::string::npos); } static void classify(const std::string& dt, bool expect_two_term, bool expect_central, const std::string& label_prefix, int& local_fail) { bool two_term = inline_is_numeric_two_term(dt); bool central = pandas::DataFrame::is_numeric_dtype(dt); pandas_tests::check(two_term == expect_two_term, label_prefix + ".two_term_classifies_as_expected (dt=" + dt + ")", local_fail); pandas_tests::check(central == expect_central, .. _example-applyresultinference-observe_probe-1: .. dropdown:: observe_probe (pd_test_5_all.cpp:97995) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 97985 :emphasize-lines: 11 std::string("c")}); // Match pandas' Series short dtype convention. s.set_dtype_override("object"); return s; } static Cb cb_int(Hist& hist) { return [&hist](const pandas::MapCellInput& in) { pandas::ApplyResultInference::ProbeDescriptor d; d.is_int = true; pandas::ApplyResultInference::observe_probe(hist, d); (void)in; return pandas::ApplyCellResult::of_int(42); }; } static Cb cb_bool(Hist& hist) { return [&hist](const pandas::MapCellInput& in) { pandas::ApplyResultInference::ProbeDescriptor d; d.is_bool = true; pandas::ApplyResultInference::observe_probe(hist, d);