Signature | Description | Parameters |
---|---|---|
template<typename ... Ts> std::size_t load_data(IndexVecType &&indices, Ts ... args); |
This is the most generalized load function. It creates and loads an index and a variable number of columns. The index vector and all column vectors are "moved" to DataFrame. Returns number of items loaded |
Ts: The list of types for columns in args indices: A vector of indices (timestamps) of type IndexType; args: A variable list of arguments consisting of std::pair(const char *name, std::vector<T> &&data). Each pair represents a column data and its name |
std::cout << "\nTesting load_data ..." << std::endl; MyDataFrame df; std::vector<int> &col0 = df.create_column<int>(static_cast<const char *>("col_name")); std::vector<int> intvec = { 1, 2, 3, 4, 5 }; std::vector<double> dblvec = { 1.2345, 2.2345, 3.2345, 4.2345, 5.2345 }; std::vector<double> dblvec2 = { 0.998, 0.3456, 0.056, 0.15678, 0.00345, 0.923, 0.06743, 0.1 }; std::vector<std::string> strvec = { "Col_name", "Col_name", "Col_name", "Col_name", "Col_name" }; std::vector<unsigned long> ulgvec = { 1UL, 2UL, 3UL, 4UL, 5UL, 8UL, 7UL, 6UL }; std::vector<unsigned long> xulgvec = ulgvec; const size_t total_count = ulgvec.size() + intvec.size() + dblvec.size() + dblvec2.size() + strvec.size() + xulgvec.size() + 9; // NaN inserterd MyDataFrame::size_type rc = df.load_data(std::move(ulgvec), std::make_pair("int_col", intvec), std::make_pair("dbl_col", dblvec), std::make_pair("dbl_col_2", dblvec2), std::make_pair("str_col", strvec), std::make_pair("ul_col", xulgvec)); assert(rc == 48);