Skip to content

Commit c398cb8

Browse files
akbakb
authored andcommitted
Add csv alias
1 parent cccc77f commit c398cb8

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,42 @@ Generate json objects
471471
472472
473473
474+
Read csv file
475+
+++++++++++++
476+
477+
Read a csv file into Python dicts.
478+
479+
480+
.. code-block:: bash
481+
482+
% mario csv < names.csv
483+
{'name': 'Alice', 'age': '21'}
484+
{'name': 'Bob', 'age': '25'}
485+
486+
487+
.. code-block:: toml
488+
489+
[[alias]]
490+
491+
name = "csv"
492+
short_help = "Load csv rows into python objects"
493+
494+
[[alias.stage]]
495+
496+
command = "apply"
497+
options = {code="csv.DictReader"}
498+
499+
[[alias.stage]]
500+
501+
command = "chain"
502+
503+
[[alias.stage]]
504+
505+
command = "map"
506+
options = {code="dict"}
507+
508+
509+
474510
Plugins
475511
~~~~~~~
476512

0 commit comments

Comments
 (0)