Closed arjen-Lee1993 closed 11 months ago
What error do you get? Alternatively you can do
df.get_column<double>("value") = std::move(result);
or you can use load_result_as_column().
What error do you get? Alternatively you can do
df.get_column<double>("value") = std::move(result);
or you can use load_result_as_column(). @hosseinmoein Thanks for your reply! i tried but still get errors. my whole codes here:
using namespace hmdf; using StrDataFrame = StdDataFrame<std::string>; StrDataFrame df; std::vector<std::string> ss = {"1", "2", "3", "4", "5"}; std::vector<double> dd = {-1, -0.4, -0.3, 0, -0.8}; df.load_index(StrDataFrame::IndexVecType{ss}); df.load_column("value", dd);
StandardizeVisitor<double, std::string, 64> stand_v;
auto result = df.single_act_visit<double>("value", stand_v).get_result();
df.get_column<double>("value") = std::move(result);
errs here:
no match for ‘operator=’ (operand types are ‘hmdf::DataFrame<std::__cxx11::basic_string<char>, hmdf::HeteroVector<0> >::ColumnVecType<double>’ {aka ‘std::vector<double, std::allocator<double> >’} and ‘std::remove_reference<std::vector<double, hmdf::AlignedAllocator<double, 64> >&>::type’ {aka ‘std::vector<double, hmdf::AlignedAllocator<double, 64> >’})
my dataframe version is v2.2.0, installed by conan
Ok, the reason is that your vectors are two different types. You declared your visitor to allocate memory on 64
byte boundary, whereas you declared your DataFrame to allocate memory on default
boundaries.
Change your visitor declaration to
StandardizeVisitor<double, std::string> stand_v;
hi guys. my df contains "index" and "value(double)" column, i want to do normalization to the "value" column.i follow the guide from (https://htmlpreview.github.io/?https://github.com/hosseinmoein/DataFrame/blob/master/docs/HTML/NormalizeVisitor.html)
then how to load result back to "value" column i use
df.load_column("value", std::move(result));
but it cause err, the type of result isstd::vector<double, hmdf::AlignedAllocator<double, 64UL>>
but load_column function may not support?