kdb - Get substring into a new column -
I have a table with one column in which the data is in the following format - if the column "title" and call the table Is "s"
title
ab.123 ab.321 cde.456 cde.654 fghi.789 fghi.987
I am trying to get a unique list of characters that are "." So that I end up with:
ab cde fghi
I have tried to select the initial column in the table, then to create a Trying to update is a new column which is the status of the dot using "ss".
Update something like:
t: thedot: (title ss `) [0] by T
I Then I was trying and the third column will say the number of characters from "letter" to "n", where n is the "thedot" column.
When I try to update, I get a "type" error.
Any thoughts? I am very new to KDB, so there is no doubt that in a very simple way to simplify something.
The reason you get an error is because ss
works only on string type Does not symbolize Plus ss
is not a vector-based function, so you should change each '
. There is a need to combine with
q): thedot update: string [title] ss' "." The title of the title --------------- ab.123 2 ab.321 2 cde.456 3 cde.654 3 fghi.789 4
There are a few ways to solve your problem:
q Select different (`$ '". Vs.' string title) [[0] to tx ---- abd cde fog Q)
Html
Comments
Post a Comment