xtensor
xtensor copied to clipboard
error C2440: “static_cast” can't convert from “const A1” to “R”
my csv file column fields: date, username, vol, type all fields are string fromat. Error occurred when convert string to int:
C++ code:
auto data = xt::load_csv<string>(csvfile);
auto col2 = xt::col(data, 2)
auto vol = xt::cast<int>(col2);
ERROR: error C2440: “static_cast” can't convert from “const A1” to “R”
That seems reasonable because I think that there is no cast from std::string
to int
. You have to use std::stoi
(see https://stackoverflow.com/a/7664227/2646505 ). I don't know if we have an equivalent in xtensor. If not I would be open to having one.
that is : if I load data from a csv file, all values in it must be number? as you know, all financial data have a column date, and ticker, and security name, how to load a financial csv file to int or double? how others use xtensor to handle these files?