Best way to read CSV data file into Mir (2d array) ndslice?

jmh530 john.michael.hall at gmail.com
Wed Sep 21 13:08:14 UTC 2022


On Wednesday, 21 September 2022 at 05:31:48 UTC, mw wrote:
> Hi,
>
> I'm just wondering what is the best way to read CSV data file 
> into Mir (2d array) ndslice? Esp. if it can parse date into 
> int/float.
>
> I searched a bit, but can't find any example.
>
>
> Thanks.

It probably can't hurt to try the simplest approach first. 
`std.csv` can return an input range that you can then use to 
create a ndslice. Offhand, I don't know what D tools are an 
alternative to `std.csv` for reading CSVs.

ndslice assumes homogenous data, but you can put the Dates (as 
Date types) as part of the labels (as Data Frames). However, 
there's a bit to be desired in terms of getting that 
functionality integrated into the rest of the package [1].

[1] https://github.com/libmir/mir-algorithm/issues/426


More information about the Digitalmars-d-learn mailing list