Created
March 21, 2017 14:20
-
-
Save dshvedchenko/e45a9d1690c43d4e72f58e59eb80ed4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// input can be CSV in Text, File, anything | |
def getLHMapFromCSV(fis) { | |
def data = fis.readLines() | |
def headers = data.take(1)[0].split(',').collect{it.trim().toLowerCase()}.withIndex(0).collectEntries{i,p -> [(p):i]} | |
data.drop(1).collect{it.split(',').collect{it}.withIndex(0).collectEntries{i,p -> [(headers[p]):i]}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment