Building on the inverted table defns
dfftbl=: {. ,: ifa@}.
tblfdf=: {. , afi@{:
tblfdf dfftbl B
┌──┬──┬──┬─┐
│Id│Name │Job │Status │
├──┼──┼──┼─┤
│3 │Jerry │Unemployed│Married │
├──┼──┼──┼─┤
│6 │Jan │CEO │Marri
Hi Pawel,
I would also check out Roger Hui's great essay on Inverted Tables.
https://code.jsoftware.com/wiki/Essays/Inverted_Table
I use his verbs ifa and afi often.
ifa =: <@(>"1)@|: NB. inverted from atoms
afi =: |:@:(<"_1@>) NB. atoms from inverted
On Tue, Aug 23,
require'tables/dsv'
ex=: ({.,:,each/@:(,:each)@}.) ',' readdsv 'dept.csv'
ex
┌──┬──┬──┐
│deptno│dname │location │
├──┼──┼──┤
│10│Accounting│"New York"│
│20│Research │Dallas│
│30│Sales │Chicago │
│40│Operations│Boston
Thanks for the answers.
And how would you can go from
┌──┬──┬┐
│deptno│dname │location│
├──┼──┼┤
│10│Accounting│New York│
│20│Research │Dallas │
│30│Sales │Chicago │
│40│Operations│Boston │
└──┴──┴┘
to
┌──
It looks like you are trying to use the inverted Table format but with a
header row.
load 'tables/dsv general/misc/inverted'
({. ,: ifa@:}.) ',' readdsv 'test.csv'
┌──┬──┬──┐
│deptno│dname │location │
├──┼──┼──┤
│10│Accounting│"New York"│
│20
({.,:,each/@:(,:each)@}.) ',' readdsv 'dept.csv'
┌──┬──┬──┐
│deptno│dname │location │
├──┼──┼──┤
│10│Accounting│"New York"│
│20│Research │Dallas│
│30│Sales │Chicago │
│40│Operations│Boston│
└──┴──┴──┘
Dear J enthusiasts,
Let's say I have the following csv file
$ cat dept.csv
deptno,dname,location
10,Accounting,"New York"
20,Research,Dallas
30,Sales,Chicago
40,Operations,Boston
Now I read it using dsv addon:
load 'tables/dsv'
readdsv jpath './dept.csv'
┌──┐
│deptno,dna