xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

how to sum string type load from csv? and how to convert string column to timestamp?

Open xkungfu opened this issue 4 years ago • 3 comments

my csv file column fields: date, username, vol, type

all fields are string fromat.

can't load as double, but when load as string,

I can't sum vol column, and can't select rows by date range.

how to convert string column to int or double?

and how to convert string column to timestamp?

PS: why I can't find any doc and issue about my question? why others didn't have this issue?

thanks!

xkungfu avatar Aug 03 '21 08:08 xkungfu

I try to convert string to int by below code: auto vol = xt::col(csvdata, 2); auto vol_int = xt::cast(vol);

it can't work too!

xkungfu avatar Aug 03 '21 08:08 xkungfu

any good man can help?

and now I find xt::cast need xt::xarray as param. but xt::col is xt::view.

then, how to convert xt::view to xt::xarray? or how to get c col from csv to xt::xarray?

it is a maze without exits for me .

xkungfu avatar Aug 03 '21 09:08 xkungfu

thanks!

xkungfu avatar Aug 03 '21 09:08 xkungfu