Phew! Thank you. That did it. I did need to add the nil to each nth
statement, but this helps.
(defn process-file
"Process csv file and prints a column in every row"
[file-name]
(let [data (slurp file-name)
rows (parse-csv data)
read-map (zipmap (map #(nth % 11 nil) rows) (ma
I need to clarify my previous answer.
In each row of vectors I want to extract two columns and make a map of
those.
For example, for each premiseid, there is a reading.
So for this line of data
33891715,101100,"2011-06-05 23:00:00","61016","SMITH","E & J",
80581200,43,0,75,"2011-06-06 06:00
On Thu, Jun 30, 2011 at 4:30 PM, octopusgrabbus
wrote:
> Thanks for answering.
>
> I want to create a map of this output:
>
> PremiseID Reading
> 61016 101100
> 610159000 411200
> 610158000 133100
> 610157000 239400
> nil nil
>
> produced by this function
>
> (defn process-file
> "Process csv
Thanks, Ken.
Our answers crossed. I'll go try your suggestions.
On Jun 30, 4:24 pm, Ken Wesson wrote:
> On Thu, Jun 30, 2011 at 4:15 PM, octopusgrabbus
>
>
>
>
>
>
>
>
>
> wrote:
> > The dorun in this function
>
> > (defn process-file
> > "Process csv file and prints first item in every row"
>
Thanks for answering.
I want to create a map of this output:
PremiseID Reading
61016 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-na
On Thu, Jun 30, 2011 at 4:15 PM, octopusgrabbus
wrote:
> The dorun in this function
>
> (defn process-file
> "Process csv file and prints first item in every row"
> [file-name]
> (let [data (slurp file-name)
> rows (parse-csv data)]
> (dorun (map #(println (first %)) rows
>
> caus
The dorun in this function
(defn process-file
"Process csv file and prints first item in every row"
[file-name]
(let [data (slurp file-name)
rows (parse-csv data)]
(dorun (map #(println (first %)) rows
causes each row of vectors in rows to be processed.
(doseq [a-row rows]
Not sure what you mean by 'row of vectors', and 'break up each row'.
On Thu, Jun 30, 2011 at 3:20 PM, octopusgrabbus wrote:
> If I have rows of vectors, such as the return from clojure-csv\parse-
> csv
>
> ["a" 1 "b" 2 "c" 3 "d" 4]
> ["e" 5 "f" 6 "g" 7 "h" 8]
>
> How can I break up each row?
>
>
If I have rows of vectors, such as the return from clojure-csv\parse-
csv
["a" 1 "b" 2 "c" 3 "d" 4]
["e" 5 "f" 6 "g" 7 "h" 8]
How can I break up each row?
I've tried doseq in the let statement, but get an error.
On Jun 30, 2:27 pm, octopusgrabbus wrote:
> Thanks. That did it.
>
> On Jun 30, 1
Thanks. That did it.
On Jun 30, 1:22 pm, Mark Rathwell wrote:
> One way would be:
>
> (defn map-func
> "test map function"
> []
> (let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4)
> read-map (apply hash-map mtr-seq)
> (println read-map)))
>
> On Thu, Jun 30, 2011 at 1:09 P
One way would be:
(defn map-func
"test map function"
[]
(let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4)
read-map (apply hash-map mtr-seq)
(println read-map)))
On Thu, Jun 30, 2011 at 1:09 PM, octopusgrabbus wrote:
>
> Given this function
>
> (defn map-func
>"test m
Given this function
(defn map-func
"test map function"
[]
(let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4)
read-map ()
(println read-map)))
I want to load read-map with the keys and values from mtr-seq.
Eventually, this data is going to be from the return from pars
12 matches
Mail list logo