data parsing works for data with strings now

This commit is contained in:
Ryan Boldi 2022-06-11 10:24:45 -04:00
parent 72d325a609
commit cddb60c63f

View File

@ -71,6 +71,12 @@
"grade" "grade"
"count-odds"])) "count-odds"]))
(defn read-string-and-convert [elem]
(let [before (read-string elem)]
(if (symbol? before)
(str before)
before)))
(defn read-data-that-has-no-strings [problem train-or-test] (defn read-data-that-has-no-strings [problem train-or-test]
(apply list (with-open [reader (io/reader (str "picked/" problem "-" train-or-test ".csv"))] (apply list (with-open [reader (io/reader (str "picked/" problem "-" train-or-test ".csv"))]
(let [csv-data (csv/read-csv reader)] (let [csv-data (csv/read-csv reader)]
@ -78,4 +84,5 @@
(->> (first csv-data) ;; First row is the header (->> (first csv-data) ;; First row is the header
(map keyword) ;; Drop if you want string keys instead (map keyword) ;; Drop if you want string keys instead
repeat) repeat)
(map (fn [elem] (map #(read-string %) elem)) (rest csv-data))))))) (map (fn [elem] (map #(read-string-and-convert %) elem)) (rest csv-data)))))))