KX Community

Find answers, ask questions, and connect with our KX Community around the world.

Home Forums kdb+ pyq add column to table

  • pyq add column to table

    Posted by laura on June 28, 2021 at 12:00 am

    Greetings all,

    Trying to add a numpy array (as a column) to a table in pyq. Pyq documentation doesn’t seem to have an answer for me.

    Any help greatly appreciated.

    laura replied 1 month, 2 weeks ago 1 Member · 3 Replies
  • 3 Replies
  • laura

    Administrator
    June 28, 2021 at 12:00 am

    For others looking for PyQ documentation. This is the most up to date pdf I was able to find 

  • laura

    Administrator
    June 28, 2021 at 12:00 am

    so play along with me:

    1) have tried table[`col] or table.col assignment — no go

    2) have tried “update” which naturally won’t work given that im not trying to create a new col from data existing within the table itself

    3) have tried to upsert the column as its own table into the existing table (it should work given they’re of the same length) but thusfar no go.

    what’s the pyq-onic way to do this?

  • laura

    Administrator
    June 29, 2021 at 12:00 am

    ANSWER: table.update(‘col’,col=py list)

Log in to reply.