Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(ns duplicates
(:require [clojure.data.csv :as csv]
[clojure.java.io :as io]
[clojure.string :as str]
[spec-provider.stats :as stats]
[clojure.pprint :as pp]))
(defn csv-data->maps [csv-data]
(map zipmap
(->> (first csv-data)
(map (comp keyword #(str/replace % #" " "-")))
repeat)
(rest csv-data)))
(defn write-dataset-edn! [out-file raw-dataset-map]
(with-open [w (clojure.java.io/writer out-file)]
(binding [*out* w]
(pp/write raw-dataset-map))))
(defn -main []
(->>
(csv/read-csv (io/reader "data/file.csv") :separator \;)
(csv-data->maps)
(stats/collect)
(write-dataset-edn! "output/stats.edn")))
@Charlynux

This comment has been minimized.

Show comment
Hide comment
@Charlynux

Charlynux Apr 8, 2018

deps.edn

{:deps
 {org.clojure/data.csv {:mvn/version "0.1.4"}
  spec-provider {:mvn/version "0.4.11"}}}
Owner

Charlynux commented Apr 8, 2018

deps.edn

{:deps
 {org.clojure/data.csv {:mvn/version "0.1.4"}
  spec-provider {:mvn/version "0.4.11"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment