updated kv to support inverted tables.

https://github.com/Pascal-J/kv/blob/main/kv.ijs


output for these functions are near bottom of 
https://raw.githubusercontent.com/Pascal-J/kv/main/README.md

'Id Name Job Status' kv ,.&.:>"1 |: maybenum each > ','cut each cutLF 0 : 0 NB. 
from your example

3,Jerry,Unemployed,Married
6,Jan,CEO,Married
5,Frieda,student,Single
1,Alex,Waiter,Separated
)


A one line dsl version:

itdsl kvdsL 'Id Name Job Status `3 6 5 1 ; Jerry Jan Frieda Alex 
;Unemployed:CEO:student:Waiter; Married Married Single Separated' 
NB. note extra garbage spaces

In a dictionary, inverted tables are stored as key(fieldname), and associated 
boxed table (field value that can be longer than 1 char per value).

I have an inverted table display (keys as column headers) too.  That can 
optionally filter just the fields you wish

A query that retrieves records where Job is 'CEO' or 'student' then displays in 
IT format

itdisp ('CEO;student' padstrmatch 'Job' kvget ]) kvQ it_kvtest_

or partial 3 column display without the special ; parsing

'Id Name Job' itdisp1 (('CEO';'student') padstrmatch 'Job' kvget ]) kvQ it

kvQ is a "query engine" (too simple to call it that) that takes a boolean 
function to filter records "on set of properties/fields"

Basically an inverted table as a dictionary is a dictionary that only contains 
the properties corresponding to fields.  Because kv can store other 
dictionaries, if you have additional information to store, it can be in "peer" 
keys to your IT dictionary.




On Sunday, February 13, 2022, 08:49:02 a.m. EST, Ric Sherlock 
<tikk...@gmail.com> wrote: 





Inspired by recent threads, I've started experimenting with a DataFrame
structure in J.
I began by building off the 'general/misc/inverted' utilities so that a
DataFrame is just a 2-row table, where the first row is a list of labels &
the 2nd is an inverted table.

It can be installed as 'tables/dataframe' from the following github
repository: https://github.com/tikkanz/jdataframe

The JArrow bindings that Aaron pointed me at a while back represent a
similar data structure as a 2-column table where the labels are in the
first column and the "columns" are rows in the 2nd column.
(https://github.com/tikkanz/JArrow)
I think I need to play with both for a while to see which works better.

Obviously there is a lot more to do, but I thought I'd share in case anyone
has any thoughts, suggestions or wants to help take the idea further.
Ric
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to