On Thu, Jun 30, 2011 at 4:30 PM, octopusgrabbus
<octopusgrab...@gmail.com> wrote:
> Thanks for answering.
>
> I want to create a map of this output:
>
> PremiseID Reading
> 610160000 101100
> 610159000 411200
> 610158000 133100
> 610157000 239400
> nil nil
>
> produced by this function
>
> (defn process-file
>  "Process csv file and prints a column in every row"
>  [file-name]
>  (let [data (slurp file-name)
>        rows (parse-csv data)]
>        (doseq [this-row rows] (println (nth this-row 11 nil) (nth
> this-row 1 nil)))))
>
> from this data:
>
> "MeterID","Reading","ReadingDateTime","Account","CustomerLN","CustomerFN","DeviceID","DeviceType","ChannelNumber","DecodeType","LoadDateLocal","PremiseID"
> 33891715,101100,"2011-06-05 23:00:00","610160000","SMITH","E & J",
> 80581200,43,0,75,"2011-06-06 06:00:01","610160000"
> 33891773,411200,"2011-06-05 23:00:00","610159000","COMMONER","A",
> 80598726,43,0,75,"2011-06-06 06:00:01","610159000"
> 33891887,133100,"2011-06-05 23:00:00","610158000","JONES","J & M",
> 80581189,43,0,75,"2011-06-06 06:00:01","610158000"
> 33891825,239400,"2011-06-05 23:00:00","610157000","SAWTOOTH","GEORGE
> C",80598731,43,0,75,"2011-06-06 06:00:01","610157000"

Then you want (zipmap (map #(nth % 11) rows) (map #(nth % 1) rows)).

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to