Split a sku into its parts
Your task
Given products with columns sku, category, price and stock, where every sku looks like A-1, split it on the hyphen into letter and number, keeping number as a string. Return sku, letter and number, sorted by sku ascending.
Examples
split_sku(products: dataframe) -> dataframeExample 1
Input
split_sku(products)products
| sku | category | price | stock |
|---|---|---|---|
| A-1 | tools | 9.99 | 12 |
| B-2 | tools | 24.5 | 0 |
| C-3 | garden | 15 | 7 |
| D-4 | garden | 15 | 3 |
| E-5 | kitchen | 42 | 0 |
Output
| sku | letter | number |
|---|---|---|
| A-1 | A | 1 |
| B-2 | B | 2 |
| C-3 | C | 3 |
| D-4 | D | 4 |
| E-5 | E | 5 |