Change the case of the input.
Note: Non-string values will be passed through unaltered.
SampleParameterswrangles:
- convert.case:
input: column
output: new column
case: upper
where: column = 'more text'
| | |
| column |
| some text |
| more text |
| some more text |
|
→
|
| column |
new column |
| some text |
|
| more text |
MORE TEXT |
| some more text |
|
|
| Parameter |
Required |
Data Type |
Notes |
| input |
✓ |
str, list |
|
| output |
|
str, list |
If omitted, the input column will be overwritten. |
| case |
✓ |
lower / upper / title / sentence |
|
| where |
|
str |
Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' |
| where_params |
|
str |
Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) |
| if |
|
str |
A condition that will determine whether the action runs or not as a whole. |
Change the data type of the input.
SampleParameters wrangles:
- convert.data_type:
input: column
output: new column
data_type: int
| | |
|
|
→
|
| column |
new column |
| 3.14159 |
3 |
|
| Parameter |
Required |
Data Type |
Notes |
| input |
✓ |
str, list |
|
| output |
|
str, list |
If omitted, the input column will be overwritten. |
| data_type |
✓ |
str / float / int |
The data type to convert to |
| default |
|
any |
The default output if the data cannot be converted. If not provided, invalid conversions will be passed through unchanged. |
| where |
|
str |
Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' |
| where_params |
|
str |
Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) |
| if |
|
str |
A condition that will determine whether the action runs or not as a whole. |
Convert fractions to decimals
SampleParameters¶ Converting a Column of Fractions to Decimals
wrangles:
- convert.fraction_to_decimal:
input: fractions
output: decimals
decimals: 3
| Parameter |
Required |
Data Type |
Notes |
| input |
✓ |
str |
|
| output |
|
str |
If omitted, the input column will be overwritten. |
| decimals |
|
int |
Number of decimals places to show the converted fraction to. Defaults to 4 |
| where |
|
str |
Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' |
| where_params |
|
str |
Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) |
| if |
|
str |
A condition that will determine whether the action runs or not as a whole. |
Convert an object to a JSON representation.
SampleParameterswrangles:
- convert.to_json:
input: column
output: new column
| | |
| column |
['a', 'python', 'list'] |
{'python': 'dict'} |
|
→
|
| new column |
["a","python","list"] |
{"python":"dict"} |
|
| Parameter |
Required |
Data Type |
Notes |
| input |
✓ |
str, list |
|
| output |
|
str, list |
If omitted, the input column will be overwritten. |
| indent |
|
str, integer |
If indent is a non-negative integer or string, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0, negative, or "" will only insert newlines. None (the default) selects the most compact representation. Using a positive integer indent indents that many spaces per level. If indent is a string (such as '\t'), that string is used to indent each level. |
| sort_keys |
|
bool |
If sort_keys is true (default: False), then the output of dictionaries will be sorted by the key. |
| ensure_ascii |
|
bool |
If true, non-ASCII characters will be escaped. Default is false |
| where |
|
str |
Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' |
| where_params |
|
str |
Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) |
| if |
|
str |
A condition that will determine whether the action runs or not as a whole. |
Convert a JSON string into an object
SampleParameterswrangles:
- convert.from_json:
input: column
output: new column
| | |
| column |
["a","python","list"] |
{"python":"dict"} |
|
→
|
| new column |
['a', 'python', 'list'] |
{'python': 'dict'} |
|
| Parameter |
Required |
Data Type |
Notes |
| input |
✓ |
str, list |
|
| output |
|
str, list |
If omitted, the input column will be overwritten. |
| default |
|
any |
Value to return if the row is empty or fails to be parsed as JSON |
| where |
|
str |
Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' |
| where_params |
|
str |
Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) |
| if |
|
str |
A condition that will determine whether the action runs or not as a whole. |
Convert an object to a YAML representation.
SampleParameterswrangles:
- convert.to_yaml:
input: column 1
indent: 2
| | |
| column 1 |
{'Product Specs': [
{
'length': 6 inch,
'voltage': 24V,
'weight': 3lb
}
]
}
|
|
→
|
| column 1 |
Product Specs:
length: 6 inch
voltage: 24V
weight: 3lb
|
|
| Parameter |
Required |
Data Type |
Notes |
| input |
✓ |
str, list |
Name of the input column. |
| output |
|
str, list |
Name of the output column. If omitted, the input column will be overwritten |
| indent |
|
int |
Specify the number of spaces for indentation to specify nested elements |
| sort_keys |
|
bool |
If sort_keys is true (default: True), then the output of dictionaries will be sorted by key. |
| where |
|
str |
Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' |
| where_params |
|
str |
Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) |
| if |
|
str |
A condition that will determine whether the action runs or not as a whole. |
Convert a YAML representation into an object
SampleParameterswrangles:
- convert.from_yaml:
input: column 1
| | |
| column 1 |
Product Specs:
length: 6 inch
voltage: 24V
weight: 3lb
|
|
→
|
| column 1 |
{'Product Specs': [
{
'length': 6 inch,
'voltage': 24V,
'weight': 3lb
}
]
}
|
|
| Parameter |
Required |
Data Type |
Notes |
| input |
✓ |
str, list |
Name of the input column. |
| output |
|
str, list |
Name of the output column. If omitted, the input column will be overwritten |
| default |
|
any |
Value to return if the row is empty or fails to be parsed as JSON |
| if |
|
str |
A condition that will determine whether the action runs or not as a whole. |