createFromCSVFile

fun createFromCSVFile(pathToCSVFile: Path, columnTypes: Map<String, DataType>, outFileName: String, hasHeader: Boolean = true): TabularOutputFile

Reads in a CSV file and converts it to a tabular output file. The separator must be a comma.

Each row is individually processed. The number of columns for each row must be equal to the number of (name, data type) pairs supplied to define the columns.

Return

the created tabular output file

Parameters

pathToCSVFile

the path to the CSV files for reading in

columnTypes

the specification for each column of its name and data type (NUMERIC, TEXT)

outFileName

the name of the output file. It will be created in the parent directory specified by pathToCSVFile

hasHeader

indicates if the file has a header row. It will be skipped during conversion. The default is true to skip the header. The column names become the names of the columns in the tabular output file.


fun createFromCSVFile(pathToCSVFile: Path, columnTypes: Map<String, DataType>, pathToOutputFile: Path = pathToCSVFile.parent.resolve( "${KSLFileUtil.removeLastFileExtension(pathToCSVFile.fileName.toString())}_TabularFile" ), hasHeader: Boolean = true): TabularOutputFile

Reads in a CSV file and converts it to a tabular output file. The separator must be a comma.

Each row is individually processed. The number of columns for each row must be equal to the number of (name, data type) pairs supplied to define the columns.

Return

the created tabular output file

Parameters

pathToCSVFile

the path to the CSV files for reading in

columnTypes

the specification for each column of its name and data type (NUMERIC, TEXT)

pathToOutputFile

the path to the TabularOutputFile that is created. The default is a file name the same as specified by pathToCSVFile with _TabularFile appended and in the same parent directory of pathToCSVFile

hasHeader

indicates if the file has a header row. It will be skipped during conversion. The default is true to skip the header. The column names become the names of the columns in the tabular output file.