String Utilities
This page lists methods to manipulate string columns in a pipeline.
To Lower Case
Transforms incoming string or symbol columns to lowercase.
.qsp.string.toLowercase[field]
Parameters:
name | type | description | default |
---|---|---|---|
field | symbol or symbol[] or all integral types (i.e. short, int, long) | A list of column names or a list of indices. | Required |
For all common arguments, refer to configuring operators
This example transforms a random string to lowerscase
.qsp.run
.qsp.read.fromCallback[`publish]
.qsp.string.toLowercase[`y]
.qsp.write.toVariable[`output];
publish ([] x: til 5; y: ("Records"; "Name"; "AGE"; "JOB"; "owner"))
output
x y
---------
0 "records"
1 "name"
2 "age"
3 "job"
4 "owner"
sp.string.to_lowercase('counterpartyName')
Parameters:
name | type | description | default |
---|---|---|---|
field | symbol or symbol[] or all integral types (i.e. short, int, long) | field: a list of column names or a list of indices, corresponding to one of the following: - a string - a list of strings - an index - list of indexes |
Required |
A field represents a incoming stream of data. This can be any string data ex database entries
Returns:
A pipeline comprised of a to_lowercase
operator, which can be joined to other pipelines.
Examples:
>>> from kxi import sp
>>> import pykx as kx
>>> sp.run(sp.read.from_expr('([] x: til 5; y: ("Records"; "Name"; "AGE"; "JOB"; "owner"))')
| sp.string.to_lowercase('y')
| sp.write.to_variable('out'))
>>> kx.q('out')
Transforms string columns to lowercase
x y
-----------
0 "records"
1 "name"
2 "age"
3 "job"
4 "owner"
To Upper Case
Transforms incoming string or symbol columns to uppercase.
.qsp.string.toUppercase[field]
Parameters:
name | type | description | default |
---|---|---|---|
field | symbol or symbol[] or int or int[] | A list of column names or a list of indices | Required |
For all common arguments, refer to configuring operators
This example transforms a random string to uppercase
.qsp.run
.qsp.read.fromCallback[`publish]
.qsp.string.toUppercase[`y]
.qsp.write.toVariable[`output];
publish ([] x: til 5; y: ("Records"; "Name"; "AGE"; "JOB"; "owner"))
output
x y
---------
0 "RECORDS"
1 "NAME"
2 "AGE"
3 "JOB"
4 "OWNER"
sp.string.to_uppercase('accountName')
Parameters:
name | type | description | default |
---|---|---|---|
field | symbol or symbol[] or all integral types (i.e. short, int, long) | field: a list of column names or a list of indices, corresponding to one of the following: - a string - a list of strings - an index - list of indexes |
Required |
A field represents a incoming stream of data. This can be any string data ex database entries
Returns:
A pipeline comprised of a to_uppercase
operator, which can be joined to other pipelines.
Examples:
>>> from kxi import sp
>>> import pykx as kx
>>> sp.run(sp.read.from_expr('([] x: til 5; y: ("Records"; "Name"; "AGE"; "JOB"; "owner"))')
| sp.string.to_uppercase('y')
| sp.write.to_variable('out'))
>>> kx.q('out')
Transforms string columns to uppercase
x y
-----------
0 "RECORDS"
1 "NAME"
2 "AGE"
3 "JOB"
4 "OWNER"