Signature | Description | Parameters |
---|---|---|
template<typename ... Ts> DataFrame & modify_by_idx(DataFrame &rhs, sort_state already_sorted = sort_state::not_sorted); |
It iterates over all indices in rhs and modifies all the data columns in self that correspond to the given index value. If not already_sorted, both rhs and self will be sorted by index. It returns a reference to self |
Ts: The list of types for all columns. A type should be specified only once. already_sorted: If the self and rhs are already sorted by index, this will save the expensive sort operations |
MyDataFrame df_copy_con = dfx; assert((df_copy_con.is_equal<int, unsigned long, double, std::string>(dfx))); assert((! df_copy_con.is_equal<int, unsigned long, double, std::string>(dfxx))); df_copy_con.get_column<double>("dbl_col")[7] = 88.888888; assert(dfx.get_column<double>("dbl_col")[7] == 10.0); assert(fabs(df_copy_con.get_column<double>("dbl_col")[7] - 88.888888) < 0.00001); assert(! (df_copy_con.is_equal<int, unsigned long, double, std::string>(dfx))); std::cout << "dfx before modify_by_idx()" << std::endl; dfx.write<std::ostream, int, unsigned long, double, std::string>(std::cout); dfx.modify_by_idx<int, unsigned long, double, std::string>(df_copy_con); std::cout << "dfx after modify_by_idx()" << std::endl; dfx.write<std::ostream, int, unsigned long, double, std::string>(std::cout); dfx.modify_by_idx<int, unsigned long, double, std::string>(df); std::cout << "dfx after modify_by_idx()" << std::endl; dfx.write<std::ostream, int, unsigned long, double, std::string>(std::cout);