Home › Forums › PyKX › pykx pandas.read_html() fails to convert string to html table › Reply To: pykx pandas.read_html() fails to convert string to html table
-
PyKX converts a q CharVector to Python NumPy array of bytes by default.
https://code.kx.com/pykx/2.5/pykx-under-q/upgrade.html#functional-differences
q).pykx.eval["lambda x: print(type(x))"][test]; <class 'numpy.ndarray'> q).pykx.eval["lambda x: print(x)"][test]; [b'<' b't' b'a' b'b' b'l' b'e' b'>' b'<' b't' b'r' b'>' b'<' b't' b'h' ...
You can create a helper to convert to strings as you require:
q)b2s:.pykx.eval["lambda x: x.tobytes().decode('UTF-8')"] q).pykx.print pd[`:read_html]b2s[test] [ First Name Last Name Age 0 John Doe 30 1 Jane Smith 25 2 Emily Jones 22]
More info on default conversions:
https://code.kx.com/pykx/2.5/pykx-under-q/intro.html#function-argument-types
And:
https://code.kx.com/pykx/2.5/user-guide/fundamentals/text.html