CsvToMaps

See javadoc - uk.gov.gchq.koryphe.impl.function.CsvToMaps

Available since Koryphe version 1.8.0

Parses a CSV into Maps

Examples

Csv to map

Java
JSON
Full JSON
Python
final CsvToMaps function = new CsvToMaps().header("header1", "header2", "header3").firstRow(1);
{
  "class" : "CsvToMaps",
  "header" : [ "header1", "header2", "header3" ],
  "firstRow" : 1
}
{
  "class" : "uk.gov.gchq.koryphe.impl.function.CsvToMaps",
  "header" : [ "header1", "header2", "header3" ],
  "firstRow" : 1
}
g.CsvToMaps( 
  header=[ 
    "header1", 
    "header2", 
    "header3" 
  ], 
  first_row=1 
)

Input type:

java.lang.String

Example inputs:

Input TypeInputResult TypeResult
java.lang.Stringheader1,header2,header3 value1,value2,value3uk.gov.gchq.koryphe.util.IterableUtil$MappedIterable[{header3=value3, header2=value2, header1=value1}]
java.lang.Stringheader1,header2,header3 value1,value2,value3 value4,value5,value6"uk.gov.gchq.koryphe.util.IterableUtil$MappedIterable[{header3=value3, header2=value2, header1=value1}, {header3=value6", header2=value5, header1=value4}]
java.lang.Stringheader1,header2,header3 ,,value3 value4,value5,value6"uk.gov.gchq.koryphe.util.IterableUtil$MappedIterable[{header3=value3, header2=, header1=}, {header3=value6", header2=value5, header1=value4}]
java.lang.Stringheader1,header2,header3,header4 value1,value2,value3,value4 value5,value6,value7,value8"NoSuchElementException: null
nullnull
java.lang.Stringuk.gov.gchq.koryphe.util.IterableUtil$MappedIterable[]

results matching ""

    No results matching ""