xcsv: read/write CSV files¶
Defined in xtensor/xcsv.hpp
-
template<class
T
, classA
= std::allocator<T>>
xcsv_tensor<T, A>xt
::
load_csv
(std::istream &stream, const char delimiter = ',', const std::size_t skip_rows = 0, const std::ptrdiff_t max_rows = -1, const std::string comments = "#")¶ Load tensor from CSV.
Returns an xexpression for the parsed CSV
- Parameters
stream
: the input stream containing the CSV encoded valuesdelimiter
: the character used to separate values. [default: ‘,’]skip_rows
: the number of lines to skip from the beginning. [default: 0]max_rows
: the number of lines to read after skip_rows lines; the default is to read all the lines. [default: -1]comments
: the string used to indicate the start of a comment. [default: “#”]
-
template<class
E
>
voidxt
::
dump_csv
(std::ostream &stream, const xexpression<E> &e)¶ Dump tensor to CSV.
- Parameters
stream
: the output stream to write the CSV encoded valuese
: the tensor expression to serialize