Liking cljdoc? Tell your friends :D

tupelo.csv

Utils for reading CSV (comma-separated-value) formatted files.

Utils for reading CSV (comma-separated-value) formatted files.
raw docstring

attrs->entitiesclj

(attrs->entities attrs)

Inputs: [attrs :- tsk/Map] Returns: [tsk/Map]

Converts a map of attribute-vectors into a vector of entity-maps. Not lazy.

Inputs: [attrs :- tsk/Map]
Returns: [tsk/Map]

Converts a map of attribute-vectors into a vector of entity-maps. Not lazy.
sourceraw docstring

csv->attrsclj

(csv->attrs csv-input)
(csv->attrs csv-input opts)

Inputs: ([csv-input :- CsvInput] [csv-input :- CsvInput opts :- tsk/KeyMap]) Returns: tsk/KeyMap

[csv-input & {:as opts} ] Returns a map of attributes constructed from the columns of csv-input. The first line is assumed to be column label strings, which are (safely) converted into keywords. The returned map has one entry for each column label keyword. The corresponding value for each keyword is a vector of string data taken from each subsequent line in the file. See tupelo.csv/parse->entities for options. Not lazy.

Inputs: ([csv-input :- CsvInput] [csv-input :- CsvInput opts :- tsk/KeyMap])
Returns: tsk/KeyMap

[csv-input & {:as opts} ]
 Returns a map of attributes constructed from the columns of csv-input.  The first line is
 assumed to be column label strings, which are (safely) converted into keywords. The
 returned map has one entry for each column label keyword. The corresponding value for
 each keyword is a vector of string data taken from each subsequent line in the file.
 See tupelo.csv/parse->entities for options.  Not lazy.
sourceraw docstring

csv->entitiesclj

(csv->entities csv-input)
(csv->entities csv-input opts)

Inputs: ([csv-input :- CsvInput] [csv-input :- CsvInput opts :- tsk/KeyMap]) Returns: [tsk/Map]

[csv-input] [csv-input opts-map]

Load csv-input (Reader or String), returning a vector of maps. The first line is assumed to be column label strings, which are (safely) converted into keywords. String data from each subsequent line is paired with the corresponding column keyword to construct a map for that line. Default delimiter is the comma character (i.e. ,) but may be changed using the syntax such as:

 (parse-csv->row-maps <csv-data-src> {:delimiter \}|)

to select the pipe character (i.e. |) as the delimiter.

<csv-data-source> is either a multi-line-string, or a java.io.Reader. Default options map:

  {:key-fn           str/trim
   :val-fn           str/trim
   :headers?         true       ; is header row present?
   :headers-to-use   nil        ; vec of string/keyword to use as headers
   :keywordize-keys? true
   :separator        \,
   :quote            \"
  }
Inputs: ([csv-input :- CsvInput] [csv-input :- CsvInput opts :- tsk/KeyMap])
Returns: [tsk/Map]


 [csv-input]
 [csv-input opts-map]

 Load `csv-input` (Reader or String), returning a vector of maps.  The first line
 is assumed to be column label strings, which are (safely) converted into keywords.
 String data from each subsequent line is paired with the corresponding column keyword to
 construct a map for that line.  Default delimiter is the comma character (i.e. \,) but
 may be changed using the syntax such as:

     (parse-csv->row-maps <csv-data-src> {:delimiter \}|)

 to select the pipe character (i.e. \|) as the delimiter.

 <csv-data-source> is either a multi-line-string, or a java.io.Reader.  Default options map:

      {:key-fn           str/trim
       :val-fn           str/trim
       :headers?         true       ; is header row present?
       :headers-to-use   nil        ; vec of string/keyword to use as headers
       :keywordize-keys? true
       :separator        \,
       :quote            \"
      }
sourceraw docstring

csv->tableclj

(csv->table csv-input)
(csv->table csv-input opts)

Inputs: ([csv-input :- CsvInput] [csv-input :- CsvInput opts :- tsk/KeyMap]) Returns: [[s/Str]]

Load csv-input (Reader or String) into a string table (vector of vectors). Default options:

 {:separator \,
  :quote     \"}
Inputs: ([csv-input :- CsvInput] [csv-input :- CsvInput opts :- tsk/KeyMap])
Returns: [[s/Str]]

Load `csv-input` (Reader or String) into a string table (vector of vectors). Default options:

     {:separator \,
      :quote     \"}
sourceraw docstring

entities->attrsclj

(entities->attrs entities)

Inputs: [entities :- [tsk/Map]] Returns: tsk/Map

Converts a sequence of entity-maps into a map of column-vectors. Not lazy.

Inputs: [entities :- [tsk/Map]]
Returns: tsk/Map

Converts a sequence of entity-maps into a map of column-vectors. Not lazy.
sourceraw docstring

entities->csvclj

(entities->csv entities)
(entities->csv entities opts)

Inputs: ([entities :- [tsk/Map]] [entities :- [tsk/Map] opts :- tsk/KeyMap]) Returns: s/Str

Writes a sequence of EDN maps to a multi-line CSV string. Keys are output in sorted order. Optionally accepts a map-key conversion function. Default options:

  {:separator     \,
   :quote         \"
   :key-fn        kw->str
   :val-fn        ->str
   :newline       :lf     ; or :cr+lf
   :force-quote?   false
  }
Inputs: ([entities :- [tsk/Map]] [entities :- [tsk/Map] opts :- tsk/KeyMap])
Returns: s/Str

Writes a sequence of EDN maps to a multi-line CSV string.  Keys are output in
 sorted order.  Optionally accepts a map-key conversion function.  Default options:

      {:separator     \,
       :quote         \"
       :key-fn        kw->str
       :val-fn        ->str
       :newline       :lf     ; or :cr+lf
       :force-quote?   false
      }
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close