Giter Club home page Giter Club logo

csv-map's Issues

Thanks a lot for your library. May I suggest the parse-csv-k function?

Just an idea to keywordize each string key.

(defn parse-csv-k 
  "parses a csv to a map with keywords as keys
   ([csv & {:as opts}])
   passes options to clojure-csv-k"
  [csv & {:as opts}]
  (let [opts (vec (reduce concat (vec opts)))
        c (apply clojure-csv.core/parse-csv csv opts)]
  (map (partial zipmap (keyword (first c))) (rest c))))

Different results csv-map versus clojure-csv

(first (csv-map.core/parse-csv (slurp "db/etr.csv")))

;; {"" "BURSLEDON ROAD", "Y55" "Y57", "WORCESTERSHIRE" "HAMPSHIRE", "WORCESTER" "SOUTHAMPTON", "ISAAC MADDOX HOUSE" "SOLENT NHS TRUST HEADQUARTERS", "WORCESTERSHIRE HEALTH AND CARE NHS TRUST" "SOLENT NHS TRUST", "Q77" "Q70", "WR4 9RW" "SO19 8BR", "F" "J", "20110701" "20110401", "R1A" "R1C", "0" "0", "SHRUB HILL INDUSTRIAL ESTATE" "HIGHPOINT VENUE"}
(first (clojure-csv.core/parse-csv (slurp "db/etr.csv")))

;; ["R1A" "WORCESTERSHIRE HEALTH AND CARE NHS TRUST" "Y55" "Q77" "ISAAC MADDOX HOUSE" "SHRUB HILL INDUSTRIAL ESTATE" "" "WORCESTER" "WORCESTERSHIRE" "WR4 9RW" "20110701" "" "" "" "" "" "" "" "" "" "" "0" "" "F" "" "" ""]

The second example using clojure-csv.core is correct. The columns are in the wrong order in the first example.

The source CSV looks like this:

"R1A","WORCESTERSHIRE HEALTH AND CARE NHS TRUST","Y55","Q77","ISAAC MADDOX HOUSE","SHRUB HILL INDUSTRIAL ESTATE","","WORCESTER","WORCESTERSHIRE","WR4 9RW","20110701","","","","","","","","","","","0","","F","","",""
"R1C","SOLENT NHS TRUST","Y57","Q70","SOLENT NHS TRUST HEADQUARTERS","HIGHPOINT VENUE","BURSLEDON ROAD","SOUTHAMPTON","HAMPSHIRE","SO19 8BR","20110401","","","","","","","","","","","0","","J","","",""
"R1D","SHROPSHIRE COMMUNITY HEALTH NHS TRUST","Y55","Q76","WILLIAM FARR HOUSE","MYTTON OAK ROAD","","SHREWSBURY","SHROPSHIRE","SY3 8XL","20110701","","","","","","","","","","","0","","E","","",""

Can you remove -SNAPSHOT from the version number.

Otherwise, Heroku doesn't like it:

"Release versions may not depend upon snapshots. Freeze snapshots to dated versions or set the LEIN_SNAPSHOTS_IN_RELEASE environment variable to override."

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.