LocProxy#

class pandas::LocProxy#

pandas C++ class.

Example#

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

// Use LocProxy
LocProxy obj;
// ... operations ...

Constructors#

Signature

Location

Example

LocProxy(DataFrame& df, const std::string& label1, const std::string& label2)

pd_dataframe.h:3652

Other Methods#

Signature

Return Type

Location

Example

operator DataFrame() const

operator

pd_dataframe.h:3693

View

Code Examples#

The following examples are extracted from the test suite.

DataFrame (pd_test_1_all.cpp:22011)
22001        void pd_test_where_basic() {
22002            std::cout << "========= where basic functionality =======================";
22003
22004            // Create DataFrame
22005            std::map<std::string, std::vector<double>> data;
22006            data["A"] = {1.0, 2.0, 3.0, 4.0};
22007            data["B"] = {5.0, 6.0, 7.0, 8.0};
22008            pandas::DataFrame df(data);
22009
22010            // Create condition DataFrame (values > 2)
22011            std::map<std::string, std::vector<numpy::bool_>> cond_data;
22012            cond_data["A"] = {false, false, true, true};   // 1<=2, 2<=2, 3>2, 4>2
22013            cond_data["B"] = {true, true, true, true};     // all >2
22014            pandas::DataFrame cond(cond_data);
22015
22016            // Apply where with replacement value -1
22017            pandas::DataFrame result = df.where(cond, -1.0);
22018
22019            // Get column index for A - it's sorted alphabetically in std::map
22020            size_t col_a_idx = df.get_column_index("A");