HaskellGBM-0.1.0.0

Safe HaskellNone
LanguageHaskell2010

LightGBM.Utils.Csv

Contents

Description

 

Synopsis

Reading from CSV files

readColumn :: Read a => Int -> HasHeader -> ByteString -> Vector a Source #

Read in the n'th column of a CSV file

Reshaping CSV files

dropColumns :: Foldable t => t Int -> ByteString -> ByteString Source #

Drop the selected columns of the CSV file

>>> csv = pack "h0,h1,h2,h3,h4\n0,1,2,3,4\n10,11,12,13,14\n"
>>> dropColumns [1, 3] csv
"h0,h2,h4\r\n0,2,4\r\n10,12,14\r\n"

keepColumns :: Foldable t => t Int -> ByteString -> ByteString Source #

Keep only the selected columns of the CSV file

>>> csv = pack "h0,h1,h2,h3,h4\n0,1,2,3,4\n10,11,12,13,14\n"
>>> keepColumns [1, 3] csv
"h1,h3\r\n1,3\r\n11,13\r\n"