embedPy
embedPy copied to clipboard
numpy array returns as foreign
Hi. I am unable to return a numpy array as anything but foreign. Am I missing some syntax to force the conversion? I've downloaded the latest embedPy files and running a recent version of kdb and python.
user@box ~ % q KDB+ 4.0 2021.07.12 Copyright (C) 1993-2021 Kx Systems m64/ 8(16)core 65536MB user box 127.0.0.1 EXPIRE 2022.10.04 [email protected] KOD #5005939
q)\l p.q
q)sys:.p.importsys;sys[
:version] "3.10.1 (v3.10.1:2cd268a3a9, Dec 6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.. q).p.set[
x;3];.p.get[x]
3
q)np:.p.importnumpy;arange:np
:arange;arange[12]`
foreign
Just noticed the formatting was unclear.
q)\l p.q
q)sys:.p.importsys;sys[:version] "3.10.1 (v3.10.1:2cd268a3a9, Dec 6 2021, 14:28:59) [Clang 13.0.0 (clang-1300..
q).p.set[x;3];.p.get[x] 3
q)np:.p.importnumpy;arange:np:arange;arange[12]` foreign
Hi,
It looks to be an issue with either the use of Python 3.10 or an update to numpy.
Can you provide the version of numpy
that you're using please and we'll aim to take a look.
Conor
Thanks for the quick reply Conor. It's 1.22.1. I'm happy to move to another recent version if that helps.
q)np:.p.import[numpy];np[
:version]`
"1.22.1"
I've confirmed it's the numpy version that is the issue, it looks like the underlying representation at the C level has changed somewhat which we'll need to investigate. If you downgrade numpy to <1.22
the behaviour should resolve itself, at the present time there isn't an explicit workaround
Rolled back to 1.21.
q)arange[12]` 0 1 2 3 4 5 6 7 8 9 10 11
Thanks!