csvlook

Parse CSV data from STDIN and beautify output.
Like csvlook from csvkit (https://github.com/onyxfish/csvkit/)

IN

a,b,c
1,2,3

OUT

|----+---+----|
|  a | b | c  |
|----+---+----|
|  1 | 2 | 3  |
|----+---+----|

IN

title,filename,url,retrieval_date
"Event Reports for Operating Reactors",event-notification-rpt-lastmonth.txt,"http://www.data.gov/download/4028",2011-04-17
"FY 09 Education Recipients by State.",FY09_EDU_Recipients_by_State.csv,http://www.data.gov/raw/4029,2011-04-17
"FY ""10"" Education Recipients by State",Datagov_FY10_EDU_recp_by_State.csv,http://www.data.gov/raw/4509,2011-04-17

OUT

|----------------------------------------+--------------------------------------+-----------------------------------+-----------------|
|  title                                 | filename                             | url                               | retrieval_date  |
|----------------------------------------+--------------------------------------+-----------------------------------+-----------------|
|  Event Reports for Operating Reactors  | event-notification-rpt-lastmonth.txt | http://www.data.gov/download/4028 | 2011-04-17      |
|  FY 09 Education Recipients by State.  | FY09_EDU_Recipients_by_State.csv     | http://www.data.gov/raw/4029      | 2011-04-17      |
|  FY "10" Education Recipients by State | Datagov_FY10_EDU_recp_by_State.csv   | http://www.data.gov/raw/4509      | 2011-04-17      |
|----------------------------------------+--------------------------------------+-----------------------------------+-----------------|

IN

text,date,integer,boolean,float,time,datetime,empty_column,_unnamed
Chicago Tribune,1920-01-01,164,False,41800000.01,00:00:00,1920-01-01T00:00:00,,
Chicago Sun-Times,1948-01-01,63,True,1.27,14:57:13,1948-01-01T14:57:13,,Extra data past headers will be trimmed
Chicago Reader,1971-01-01,40,True,1.0,04:14:00,1971-01-01T04:14:00,,
This row has blanks,,,,,,,,
Unicode!,,,,,,,,

OUT

|----------------------+------------+---------+---------+-------------+----------+---------------------+--------------+------------------------------------------|
|  text                | date       | integer | boolean | float       | time     | datetime            | empty_column | _unnamed                                 |
|----------------------+------------+---------+---------+-------------+----------+---------------------+--------------+------------------------------------------|
|  Chicago Tribune     | 1920-01-01 | 164     | False   | 41800000.01 | 00:00:00 | 1920-01-01T00:00:00 |              |                                          |
|  Chicago Sun-Times   | 1948-01-01 | 63      | True    | 1.27        | 14:57:13 | 1948-01-01T14:57:13 |              | Extra data past headers will be trimmed  |
|  Chicago Reader      | 1971-01-01 | 40      | True    | 1.0         | 04:14:00 | 1971-01-01T04:14:00 |              |                                          |
|  This row has blanks |            |         |         |             |          |                     |              |                                          |
|  Unicode!            |            |         |         |             |          |                     |              |                                          |
|----------------------+------------+---------+---------+-------------+----------+---------------------+--------------+------------------------------------------|

IN

a,b,c
1,2,3
4,,6
5,1,7

OUT

|----+---+----|
|  a | b | c  |
|----+---+----|
|  1 | 2 | 3  |
|  4 |   | 6  |
|  5 | 1 | 7  |
|----+---+----|
Login to submit solution


72 symbols pyth
Thu Nov 10 19:12:01 2016 Sait2000
.vCim-id64^964 2cCM"෺㯾棛矺榻窺榽痸秸燚竓㰄燋㯤莻⿯泹笀紂臯沸㓳脆㒹㰂狱燵羲涸㰊㛯侲覽⿽㧧诤柺瞲⸌ⶲ燯侲覰ⶲ壓埛"3^4 8
73 symbols pyth
Thu Nov 10 18:22:37 2016 Sait2000
.vCim-id64^964 2cCM"෺㯾棛矺榻窺榽痸秸燚竓㰄燋僫吆旯㺲泯盽緿耄泯㖷焃获㚾翵滴猂㖹⾾蟯侲覽⿽㧧诤柺瞲⸌ⶲ燯侲覰ⶲ壓埛"3^4 8
82 symbols pyth
Thu Nov 3 11:38:25 2016 Sait2000
h.vCim-id64^964 2cCM"妮啽ꄫ恫퀡病窀撢曅㍽傏㾚䒄㶛쵄藗錥痳啄↵쵛↾쏜뚨污謗욝Ꚗ规哫쥽ㆀ㳫攝稌䤰릻ⷶኑⰦ㋄ᙂ积穔硇⌣䝟窗ᔨ"3 65762
88 symbols pyth
Thu Nov 10 19:09:05 2016 Sait2000
Kjj\+m*\-hhlhdJmC.td;.Tv+"__import__('csv').reader"`(.z)_B"|-"VCJjj" | "N_B"|  "I~TZK;K
89 symbols pyth
Thu Nov 10 19:05:11 2016 Sait2000
Kjj\+m*\-hhlhdJmC.td;C[Fv+"__import__('csv').reader"`(.z)_B"|-"VCJjj" | "N_B"|  "I~TZK;K
90 symbols pyth
Sat Oct 29 16:05:16 2016 Sait2000
h.vCim-i%Vd[16=T64T)T=T5953cCM"厎濶齟䯺㒐䞥⢻쑅긅ㅐꍩῬ죸䘚ᮈ仄鯗銘揝궻鰡慞츭셸阐冑⽠헛ꛠꕩ胆嵵蜛隨옥庠싛礧듁䃟鳁騎⦋⋇믥颅ꔱ㫶瞖ㆬᣠ絬㮅䡼"3*T9
90 symbols pyth
Thu Nov 10 16:15:42 2016 Sait2000
Kjj\+m*\-hhlhdJmC.td;C[FvX_1"__import__('csv').reader()".z_B"|-"VCJjj" | "N_B"|  "I~TZK;K
91 symbols pyth
Sat Oct 29 08:12:34 2016 Sait2000
h.vCim-i+%hd16td64=T5953cm%Cd64"厎濶齟䯺㒐䞥⢻쑅긅ㅐꍩῬ죸䘚ᮈ仄鯗銘揝궻鰡慞츭셸阐冑⽠헛ꛠꕩ胆嵵蜛隨옥庠싛礧듁䃟鳁騎⦋⋇믥颅ꔱ㫶瞖ㆬᣠ絬㮅䡼"3*T9
93 symbols pyth
Thu Nov 10 16:37:57 2016 Sait2000
j.n[Kjj\+m*\-hhlhdJmC.td;C[FvX_1"__import__('csv').reader()".z_B"|-"m,W~TZjj" | "d_B"|  "KCJK
93 symbols pyth
Thu Nov 10 16:50:42 2016 Sait2000
h[
Kjj\+m*\-hhlhdJmC.td;C[FvX_1"__import__('csv').reader()".z_B"|-"m,
jj" | "d_B"|  "
W~TZKCJ
94 symbols pyth
Thu Nov 10 15:56:31 2016 Sait2000
Kjj\+m*\-hhlhdJmC.td;CvX_2"list(__import__('csv').reader())".z_B"|-"VCJjj" | "N_B"|  "I~TZK;K
97 symbols pyth
Thu Nov 10 15:47:56 2016 Sait2000
KX2"|--|"j\+m*\-hhlhdJmC.td;CvX_2"list(__import__('csv').reader())".zVCJX3"|    |"j" | "NI~TZK;K
98 symbols pyth
Thu Nov 10 15:27:41 2016 Sait2000
KX2"|--|"j\+m*\-hhlhdCJCmC.td;CvX_2"list(__import__('csv').reader())".zVJX3"|    |"j" | "NI~TZK;K
101 symbols pyth
Thu Nov 10 15:22:02 2016 Sait2000
K%"|-%s-|"j\+m*\-hhlhdCJCmC.td;Cv%"list(__import__('csv').reader(%s))"`.zVJ%"|  %s  |"j" | "NI~TZK;K
103 symbols pyth
Sat Oct 22 14:50:49 2016 Sait2000
K%"|-%s-|"j\+m*\-hhlhdCJCm.t.td;;Cv%"list(__import__('csv').reader(%s))"`.zVJ%"|  %s  |"j" | "NI~TZK;K
104 symbols pyth
Fri Oct 21 21:21:24 2016 Sait2000
K%"|-%s-|"j\+m*\-hhlhdCJCm.t.td;;Cv%"list(__import__('csv').reader(%s))"`.zVJ%"|  %s  |"j" | "NI!~hZK;K
105 symbols pyth
Fri Oct 21 21:20:23 2016 Sait2000
=Y%"|-%s-|"j\+m*\-hhlhdCJCm.t.td;;Cv%"list(__import__('csv').reader(%s))"`.zVJ%"|  %s  |"j" | "NI!~hZY;Y
107 symbols pyth
Fri Oct 21 21:18:28 2016 Sait2000
=Y%"|-%s-|"j\+m*\-hdmhlhdCJCm.t.td;;Cv%"list(__import__('csv').reader(%s))"`.zVJ%"|  %s  |"j" | "NI!~hZY;Y
109 symbols pyth
Fri Oct 21 21:16:00 2016 Sait2000
KmhlhdCJCm.t.td;;Cv%"list(__import__('csv').reader(%s))"`.z
=Y%"|-%s-|"j\+m*\-hdKVJ%"|  %s  |"j" | "NI!~hZY;Y
109 symbols pyth
Sat Oct 29 08:06:38 2016 Sait2000
 [
K%"|-%s-|"j\+m*\-hhlhdCJCm.t.td;;Cv%"list(__import__('csv').reader(%s))"`.zm,
%"|  %s  |"j" | "d &~TZ
KJ
K

View all solutions