Split: Split a field using a separator¶
- class txf.Split(source, input, outputs, separator, defaults)¶
The
Split
transform replaces a field with a set of values generated from the inputs.- input: str¶
The name of the field to split. It will be dropped from the output, so use
Copy
if you need to preserve it.
- outputs: tuple(str), str¶
The output field(s) receiving the split values. They cannot overwrite existing fields. Use
Drop
to remove unwanted fields.
- separator: str or callable¶
Either a string or a
callable
used to split up the field. If it is a string, the value will be split usingstr.split
. If it is acallable
, it will be passed the value as a single argument and should return alist
of values in the order of the outputs.
- defaults: tuple¶
The value(s) to be used for missing elements of the separator result.
Usage¶
Split(p, 'Date', ('Month', 'Day', 'Year',), r'/')
Split(p, 'Year', ('Century' 'Decade', 'Year',), lambda y: [y // 100, (y % 100) // 10, y % 10])
Example¶
Query |
Run |
Branch |
---|---|---|
01_PARALLEL |
master |
|
01_PARALLEL |
Cold run…DONE |
master |
01_PARALLEL |
1/5…0.083052 |
master |
01_PARALLEL |
2/5…0.079075 |
master |
01_PARALLEL |
3/5…0.079176 |
master |
01_PARALLEL |
4/5…0.078928 |
master |
01_PARALLEL |
5/5…0.079142 |
master |
Split(p, 'Query', ('Query', 'Mode',), '_', ('00', 'SERIAL',))
Query |
Mode |
Run |
Branch |
---|---|---|---|
01 |
PARALLEL |
master |
|
01 |
PARALLEL |
Cold run…DONE |
master |
01 |
PARALLEL |
1/5…0.083052 |
master |
01 |
PARALLEL |
2/5…0.079075 |
master |
01 |
PARALLEL |
3/5…0.079176 |
master |
01 |
PARALLEL |
4/5…0.078928 |
master |
01 |
PARALLEL |
5/5…0.079142 |
master |