

rocuinneagain
Forum Replies Created
-
Printing the values being passed each time you can see a null 0N is passed for the first value of y
q)({-1 .Q.s1 (x;y;x~y);x~y}':) 1 1 1 2 2 3 4 5 5 5 6 6
(1;0N;0b)
(1;1;1b)
(1;1;1b)
(2;1;0b)
(2;2;1b)
(3;2;0b)
(4;3;0b)
(5;4;0b)
(5;5;1b)
(5;5;1b)
(6;5;0b)
(6;6;1b)
011010001101bWe can also we with prev and next that nulls are padded as needed:
q)prev 1 2 3
0N 1 2
q)next 1 2 3
2 3 0N -
rocuinneagain
MemberMarch 20, 2025 at 10:15 am in reply to: Assigning upd inside a function and replay TP logYes this is a scoping issue. upd in f is a local variable only. You can use set to assign the global variable from within a function.
students:([]id:`long$(); name:`symbol$()); f:{[x] `upd set insert; -11!`:tpLog }["foo"];
-
PyKX and q/kdb+ use the same license.
1. What command is giving you that error?
It suggests you are trying to install the license a second time.
2. What output do you see when you ‘import pykx’ in your python session?
-
rocuinneagain
MemberMarch 7, 2025 at 9:25 pm in reply to: library error on register licence and connecting on external port in azureThe error is from the kurl library under PyKX. It is not needed to use PyKX so you can ignore that warning. You can configure PyKX to not attempt to load kurl at all by setting the environment variable:
QARGS="--no-kurl"
-
This reply was modified 3 weeks, 4 days ago by
rocuinneagain.
-
This reply was modified 3 weeks, 1 day ago by
rocuinneagain.
-
This reply was modified 3 weeks, 4 days ago by
-
rocuinneagain
MemberFebruary 26, 2025 at 11:10 am in reply to: What is the implementation of the deprecated DateTime datatype?Datetime is an backed by an 8 byte float.
The sz column is correct at the top of the page for datetime:
https://code.kx.com/q/basics/datatypes/
The incorrect 4 byte reference will be removed:
https://github.com/KxSystems/docs/pull/359
-
This reply was modified 1 month ago by
rocuinneagain.
-
This reply was modified 1 month ago by
-
rocuinneagain
MemberFebruary 20, 2025 at 9:35 am in reply to: pykx DatetimeAtom,DateTimeVector how to create it ?Hi,
As the datetime type is deprecated PyKX does not have an implementation of a Python –> datetime conversion.
PyKX does not provide a rich interface for the q datetime type, as it is deprecated. Avoid using it whenever possible.
https://code.kx.com/pykx/3.1/api/pykx-q-data/wrappers.html#pykx.wrappers.DatetimeAtom
-
rocuinneagain
MemberFebruary 18, 2025 at 5:01 pm in reply to: Char datatype and Unicode? Can 8 bit charsThe unicode characters use more than a single byte
q)s:"tést" / Store text with unicode to variable q)s / Unicode bytes displayed "t\303\251st" q)count s / 2 bytes are used by é 5 q)-1 s; /Print to standard out presents the unicode characters again. tést
-
If you pad out t2 ensuring it has a row for every col1 value then you’ll get what you want:
q)t1:([] col1:`a`b`c`d;col2:1 2 3 8;col3:11 22 33 88) q)t2:([] col1:`a`a`b`c;col4:4 5 6 7;col5:44 55 66 77)
q)(t2 uj select distinct col1 from t1 where not col1 in t2`col1) lj `col1 xkey t1 col1 col4 col5 col2 col3 ------------------------ a 4 44 1 11 a 5 55 1 11 b 6 66 2 22 c 7 77 3 33 d 8 88
-
This reply was modified 2 months, 1 week ago by
rocuinneagain.
-
This reply was modified 2 months, 1 week ago by
rocuinneagain.
-
This reply was modified 2 months, 1 week ago by
rocuinneagain.
-
This reply was modified 2 months, 1 week ago by
-
rocuinneagain
MemberJanuary 10, 2025 at 10:35 am in reply to: Error when using in Jupyter : ”licence error: embedq”A PyKX enabled license must be used.
Issued from: https://kx.com/kdb-insights-personal-edition-license-download/
(Not from: https://kx.com/kdb-personal-edition-download/ )
-
Since release 4.0.0 the ML toolkit can use either PyKX or embedPy
https://github.com/KxSystems/ml/releases
Both PyKX and embedPy cannot run in the same process so installing and using only one is best.
To make PyKX available to q processes follow: https://code.kx.com/pykx/3.0/pykx-under-q/intro.html#install
The command to run is:
python -c "import pykx;pykx.install_into_QHOME()"
-
rocuinneagain
MemberMarch 20, 2025 at 2:35 pm in reply to: Assigning upd inside a function and replay TP loghttps://code.kx.com/q/basics/syntax/#prefix-infix-postfix
Due to insert being a keyword in the language which can operate with infix notation .i.e
`table insert (1;`Foo)
The `upd set insert creates a composition rather than executing as you want</p><p><br></p><p>https://code.kx.com/q/ref/compose/#implicit-composition</p><p><br></p><pre>q)`upd set insert
k){$[@x;.[x;();:;y];-19!((,y),x)]}[`upd]insert<br>q)type[`upd set insert]
105hTo bypass this you can use either square or round brackets as follows:
{[x] set[`upd;insert];-11!`:tpLog}
{[x] `upd set (insert);-11!`:tpLog}:: when executed inside a function can also do global assignment but again needs brackets to execute as you wish:
https://code.kx.com/q/basics/syntax/#colon-colon
{[x] upd::(insert);-11!`:tpLog}
-
This reply was modified 1 week, 5 days ago by
rocuinneagain.
-
This reply was modified 1 week, 5 days ago by
rocuinneagain.
code.kx.com
Syntax | Basics | kdb+ and q documentation - kdb+ and q documentation
Syntax of the q programming language
-
This reply was modified 1 week, 5 days ago by
-
I checked and if you previously registered for that type of licence and you request a new one before the previous is expired you will be sent the original license. When this one expires you can request a new one on the 18th which will be valid for a further 90 days.
-
What is the output of: kx.q.take(4,kx.q.z.l) ? Normally it should be issued with a longer duration.
-
Your license does not have a needed flag to enable PyKX.
Go to: https://kx.com/kdb-insights-sdk-personal-edition-download/
Download this new license and install it and this new license will work for kdb+ and PyKX for you.
-
Do you have warnings supressed?
The output of the failed import should be like:
PYKX_GC=True python test.py
<frozen importlib._bootstrap>:241: PyKXWarning: Failed to initialize PyKX successfully with the following error: Captured output from initialization attempt:
'2025.01.10T12:11:03.276 licence error: k4.lic
License location used:
Traceback (most recent call last):
File "/home/rocuinneagain/q/test.py", line 1, in <module>
import pykx as kx
File "/home/rocuinneagain/.pyenv/versions/3.11.5/lib/python3.11/site-packages/pykx/__init__.py", line 32, in <module>
from . import core
File "pykx/core.pyx", line 394, in init pykx.core
pykx.exceptions.PyKXException: Early garbage collection requires a valid q license.Your output is missing the first line.
Do you have the QLIC environment variable set?
You put your license in /home/rr/q/l64/
A more standard location would be one level higher at /home/rr/q/
Can you start python with PYKX_UNLICENSED=True python
Then run:
>>> import pykx as kx
>>> kx.util.debug_environment()And share the output here? It will give more information on your environment.