Re: [Jprogramming] dsv question

2022-08-23 Thread Ric Sherlock
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

Re: [Jprogramming] dsv question

2022-08-23 Thread 'Kenneth Lettow' via Programming
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,

Re: [Jprogramming] dsv question

2022-08-23 Thread Raul Miller
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

[Jprogramming] dsv question

2022-08-23 Thread Pawel Jakubas
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 ┌──

Re: [Jprogramming] dsv question

2022-08-17 Thread Ric Sherlock
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

Re: [Jprogramming] dsv question

2022-08-17 Thread Raul Miller
({.,:,each/@:(,:each)@}.) ',' readdsv 'dept.csv' ┌──┬──┬──┐ │deptno│dname │location │ ├──┼──┼──┤ │10│Accounting│"New York"│ │20│Research │Dallas│ │30│Sales │Chicago │ │40│Operations│Boston│ └──┴──┴──┘

[Jprogramming] dsv question

2022-08-17 Thread Pawel Jakubas
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