org.clojars.punit-naik.clj-ml.utils.io
find-field-names
(find-field-names file-path delimiter)
Finds the names of the fields of an XSV file
maps->xsv-data
(maps->xsv-data delimiter maps)
Takes a collection of maps and returns csv-data
(vector of vectors with all values).
read-file-lines
(read-file-lines file-path)
Reads a file from the `file-path` and returns a lazy sequence of strings
row->map
(row->map rows delimiter field-names result)
Takes `rows` as a collection, fetches it's first row,
Splits it on `delimiter`,
Coverts the resulting row into a map by using keys from `field-names`,
And then finally appends it to the `result`
write-xsv
(write-xsv file xsv-data)
Takes a file (path, name and extension) and
csv-data (vector of vectors with all values) and
writes csv file.
write-xsv-from-maps
(write-xsv-from-maps file maps)
(write-xsv-from-maps file maps delimiter)
Takes a file (path, name and extension) and a collection of maps
transforms data (vector of vectors with all values)
writes csv file.
Optionall provide a delimiter, defaults to `,`
xsv-reader
(xsv-reader file-path)
(xsv-reader file-path has-field-names?)
(xsv-reader file-path has-field-names? delimiter)
(xsv-reader file-path has-field-names? delimiter field-names)
Reads an XSV file and generates a collection of maps where each map in the colection
represent a row with the keys as the column names and it's values as the row's values
NOTE: X represents a delimiter
`file-path` is the XSV file's path
`delimiter` is the delimiter value used in the XSV file, the default value of it is `,`
`field-names` is the collection of column names of the XSV file
If it is not supplied, the function will read it from the first row of the file