From cddb60c63fc15f3ad1591c13342463659f812550 Mon Sep 17 00:00:00 2001 From: Ryan Boldi Date: Sat, 11 Jun 2022 10:24:45 -0400 Subject: [PATCH] data parsing works for data with strings now --- src/propeller/problems/data_creation.cljc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/propeller/problems/data_creation.cljc b/src/propeller/problems/data_creation.cljc index 193b14d..33c38e5 100644 --- a/src/propeller/problems/data_creation.cljc +++ b/src/propeller/problems/data_creation.cljc @@ -71,6 +71,12 @@ "grade" "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] (apply list (with-open [reader (io/reader (str "picked/" problem "-" train-or-test ".csv"))] (let [csv-data (csv/read-csv reader)] @@ -78,4 +84,5 @@ (->> (first csv-data) ;; First row is the header (map keyword) ;; Drop if you want string keys instead repeat) - (map (fn [elem] (map #(read-string %) elem)) (rest csv-data))))))) + (map (fn [elem] (map #(read-string-and-convert %) elem)) (rest csv-data))))))) +