Please help me to write a function to find difference of two lists including duplicate elements. Lists are not equal lengths.
q)l1:1 1 2 3 3 4 4 5 6 7
q)l2: 1 1 2 4 5 6
q)l1 except l2
3 3 7 /4 is missing in result
/expected result : 3 3 4 7
Please help me to write a function to find difference of two lists including duplicate elements. Lists are not equal lengths.
q)l1:1 1 2 3 3 4 4 5 6 7
q)l2: 1 1 2 4 5 6
q)l1 except l2
3 3 7 /4 is missing in result
/expected result : 3 3 4 7
你们可以尝试这样的事情:
q){$[any found:x in y;x _:first where found;x]}/[l1;l2]
3 3 4 7
它通过第2号中的物品,看看是否有1英里的物品,并放下。
<代码>组代码>功能可在此查阅。
{
e: (count each group x) - (count each group y);
e: (where e>0)#e;
raze (value e)# (key e)
}
On the 1st
step we check how many numbers are in both lists and subtract counts.
Then we keep only numbers with positive counts and convert number->count
dictionary into desired list.
请帮助我写一份职务,以找到包括重复内容在内的两个清单的差异。
Say I have a list of symbols like so... q) list `hello_world.q `hello_world_2.q I d like to split this so I end up with this list of strings... q) new_list "hello_world" "hello_world_2&...
I can append a string with number. temp:30 text:"Current temperature is ",string temp show text type text Result "Current temperature is 30" 10h However, if I append one more ...
Most of the examples seem to be run in REPL mode. Is it possible to load myprog.q from disk?
What are the ways to in Q to use the results of a nested query in a where clause? I m looking for something similar to SQL statement. select from food where type_id in ( select type_id from ...
I m writing a q script that loads a db in a particular path and does some processing on it. The location of the db is currently hardcoded in the script, but I want to pass the db path as an argument ...
I am learning KDB+ and have loaded the tic data into the table W as below. My question is, how to transfer the data into 5 (or n) minutes OHLCVA? "Stk_ID","Date","Time","Price","Chg","Vol","Amt","Ty" ...
I am trying to find first date where we have data available per process over IPC. I tried below but it isn t efficient. Is there a better way to find this? select min date from ({select date from x ...