Package: csvprint
csvprintA command-line utility for pretty printing csv files and converting to other formats.InstallationIf Python 3 with the package manager pip is installed, doingpip3 install csvprintin your terminal should do the trick.Development installationWithpipenvinstalled.Clone this repoDopipenv installpipenv shellpip install -e .Usagecsvprint [filename]prints a formatted table iffilenameis a comma separated file.» cat imdb.csv
Title,Release Year,Estimated Budget
Shawshank Redemption,1994,$25 000 000
The Godfather,1972,$6 000 000
The Godfather: Part II,1974,$13 000 000
The Dark Knight,2008,$185 000 000
12 Angry Men,1957,$350 000

» csvprint imdb.csv
Title                  Release Year Estimated Budget
Shawshank Redemption   1994         $25 000 000
The Godfather          1972         $6 000 000
The Godfather: Part II 1974         $13 000 000
The Dark Knight        2008         $185 000 000
12 Angry Men           1957         $350 000You can also pipe intocsvprint:» cat imdb.csv | csvprint
Title                  Release Year Estimated Budget
Shawshank Redemption   1994         $25 000 000
The Godfather          1972         $6 000 000
The Godfather: Part II 1974         $13 000 000
The Dark Knight        2008         $185 000 000
12 Angry Men           1957         $350 000OptionsCommandResult-aspecify alignment (left or right) - see examples below-cspecify which columns to print-hprint help message--markdownprint as markdown--latexprint as latex table--numeric [c1:d1] [c2:d2] ...specify decimal numbers for chosen numeric columns (cfor column,dfor digits)--headeradd header decoration around the first line-s 'char'file is delimited bychar(instead of comma),tabfor tab-p [n]add a padding ofnspaces for each column, on both sides-d [string]specify the string to separate columnsAlignment exampleThere are three options for specifying alignment. One can uselorrfor aligning all cells to the left or right, respectively. One can also specify a distinct alignment option for each column. Then the number of options will need to match the number of columns.» csvprint imdb.csv -a l r r
Title                  Release Year Estimated Budget
Shawshank Redemption           1994      $25 000 000
The Godfather                  1972       $6 000 000
The Godfather: Part II         1974      $13 000 000
The Dark Knight                2008     $185 000 000
12 Angry Men                   1957         $350 000Markdown exampleMarkdown output also supports left and right alignment.» csvprint examples/imdb.csv --markdown -a l r r
Title                  | Release Year | Estimated Budget
:----------------------|-------------:|----------------:
Shawshank Redemption   |         1994 |      $25 000 000
The Godfather          |         1972 |       $6 000 000
The Godfather: Part II |         1974 |      $13 000 000
The Dark Knight        |         2008 |     $185 000 000
12 Angry Men           |         1957 |         $350 000When rendered as HTML, this looks likeTitleRelease YearEstimated BudgetShawshank Redemption1994$25 000 000The Godfather1972$6 000 000The Godfather: Part II1974$13 000 000The Dark Knight2008$185 000 00012 Angry Men1957$350 000Numeric example» csvprint examples/numeric.csv
measure1  measure2
1.2323    9000
1.299     9000001

» csvprint examples/numeric.csv --numeric 1:1 2:1
measure1  measure2
1.2       9000.0
1.3       9000001.0TestingRunpytestwhile in the root directory of this repository.